Training an Argos Translation Model Locally on Windows

Setting up Nvidia GPU to use CUDA

Running Argos Train on Docker

docker run --gpus all -it argosopentech/argostrain /bin/bash

If it already exists

docker container attach argostrain

Initialize

su argosopentech
source ~/argos-train-init

Add data from Download Text for Training to data-index.json for each .argosdata file

{
	"name": "<dataSource>",
	"type": "data",
	"from_code": "<codeFrom>",
	"to_code": "<codeTo>",
	"size": <size>,
	"reference": "",
	"links": [
		"<linkToArgosdataFile>"
	]
}

Train

argos-train

You will then get some prompts, for English to Thai enter the following:

From code (ISO 639): en
To code (ISO 639): th
From name: English
To name: Thai
Version: 1.0.0

On finish you should see something like this

Testing Model

pip install argostranslate
pip install pathlib
python
import argostranslate.package
import argostranslate.translate
import pathlib

argostranslate.package.update_package_index()
package_path = pathlib.Path("<file_name>.argosmodel")
argostranslate.package.install_from_path(package_path)

translatedText = argostranslate.translate.translate(term, from_code, to_code)

Troubleshooting

If you have CUDA issues this could be because your WSL version is not up to date. To update perform the following steps:

  • Go to Settings > Check for Updates

  • Select Advanced Options and turn on receiving updates for other products (WSL)
    updates-other-products

  • Go back and select “Check for updates” and install any updates. Restart and you should have the latest WSL version; you can check this with wsl cat /proc/version and you want a version greater than 5.10.43

2 Likes