Ability to load firefox-translations-models
c6401 opened this issue · 3 comments
Wondering if I can load some of models from https://github.com/mozilla/firefox-translations-models ?
Yes, it is possible :)
Let's say you want the Dutch - English model.
- Create a folder called
nlen.student.tinyin User/>Your username</Appdata/Roaming/translateLocally - Download the files here
- Unpack each file to your new folder
- Create a file called
model_info.jsonand copy & paste this text;
{
"modelName": "Dutch-English tiny",
"shortName": "nl-en-tiny",
"type": "tiny",
"src": "Dutch",
"trg": "English",
"srcTags": {"nl": "Dutch"},
"trgTag": "en",
"repository": "Bergamot",
"version": 1,
"API": 1
}
- Create a file called
config.intgemm8bitalpha.ymland copy & paste this text;
relative-paths: true
models:
- model.nlen.intgemm.alphas.bin
vocabs:
- vocab.nlen.spm
- vocab.nlen.spm
shortlist:
- lex.50.50.nlen.s2t.bin
- false
beam-size: 1
normalize: 1.0
word-penalty: 0
mini-batch: 64
maxi-batch: 1000
maxi-batch-sort: src
workspace: 2000
max-length-factor: 2.0
skip-cost: true
gemm-precision: int8shiftAlphaAll
- You should now be able to see it in the translateLocally app
That's it. Basically you just have to adjust each of their models to fit into translateLocally's format.
Keep in mind that you'll have to rename some lines in these two files to adjust for other languages. Some models may also have two vocab files, one for source and one for target.
Edit;
While the config.intgemm8bitalpha.yml in the example above may work just fine in terms of quality/performance, it may not be ideal for every model. Unfortunately, I can't help you with that at the moment as I don't possess the knowledge of how it works in detail yet.
Awesome, thank you!
the solution works brillliantly