Local cross-platform machine translation GUI, based on CTranslate2
Local cross-platform machine translation GUI, based on CTranslate2
Table of contents
Currently, DesktopTranslator supports CTranslate2 models, and SentencePiece subwording models (you need both). If you have a model for OpenNMT-py, OpenNMT-tf, or FairSeq, you can convert it to the CTranslate2 format.
If you would like to try out the app and you do not have a model, you can download my French-to-English generic model here.
fren.zip
archive of the French-to-English generic model you just downloaded. It has two folders, ct2_model
for the CTranslate2 model and sp_model
for the SentencePiece subwording models of French (source) and English (target).ct2_model
folder.sp_model
folder, and select fr.model
.Now, DesktopTranslator supports M2M-100 (Fan et al., 2020), a multilingual model that can translate between 100 languages.
To use M2M-100 models in DesktopTranslator, please follow these steps:
m2m100_418m
or m2m100_12b
folder.sentencepiece.model
.OPUS models (Tatoeba-Challenge) can be used and they can be more efficient. As of now, only bilingual models are supported by DesktopTranslator. Note: You must convert an OPUS model to the CTranslate2 format first. Example command:
ct2-opus-mt-converter --model_dir opus_model_dir --output_dir ct2_model_dir --quantization int8
The source and target tokenization SentencePiece models can be found in the same archive of the downloaded model.
If you want to adjust the code and then build an installer yourself, you can follow these steps:
pip3 install pyinstaller
pyinstaller -y -w "translator.py"
If you would like to add an extra folder, e.g. "utils", the command will be:
pyinstaller -y -w --add-data="utils/*;utils/" "translator.py"
*.exe
file under "dist\translator" to make sure it works. It might complain about the Pmw library. The solution is either remove the Balloon lines, or add this file to the same folder as the translate.py
and run the aforementioned PyInstaller command again.$PROGRAMFILES
Section "Desktop Shortcut" SectionX
SetShellVarContext current
CreateShortCut "$DESKTOP\DesktopTranslator.lnk" "$PROGRAMFILES\DesktopTranslator\translator.exe"
SectionEnd
If you get a permission error while trying to save the edited version of “Modern.nsh”, right-click your text editor (e.g. Notepad), and select "Run as administrator". Then, copy the contents of the file into a new file, and save it to the original location.
9. Finally, click the NSIS Generate button, which will create the *.exe installer that can be shipped to other Windows machines, without the need to install any extra requirements.
10. After installation, if you applied step #8, you should find an icon on the Desktop. To uninstall, you can simply remove the app folder from "Program Files". For more NSIS options, check this example.
py2app
pip3 install py2app==0.25
-A
to test the app first.python3 setup.py py2app