OptimaMT is a set of free translation models that run locally, on your own computer or in the browser: 49 translation directions built from the University of Helsinki's OPUS-MT models and optimized for ONNX Runtime. Same translations, about half the memory in fast mode, and a drop-in replacement: swap the model name and you're done.
ONNX Runtime's fast mode at half the memory: 2.3–2.5× faster than the default, same translations.
Fast mode used to cost double memory; OptimaMT keeps it fast and light. Medians of 5 reference pairs.
Same translations: on FLORES-200 devtest all 49 pairs give identical output, so identical BLEU.
Full technical report (PDF): OptimaMT-Technical-Report.pdf · more charts, the browser results and every number: REPORT.md · interactive results and a live demo: OptimaMT/results
- OpenCircle, a desktop screen translator for Windows and Linux, ships these models since v0.1.4.
import { pipeline } from "@huggingface/transformers";
const translator = await pipeline("translation", "OptimaMT/de-en", {
dtype: "q8",
session_options: { extra: { session: { disable_quant_qdq: "1" } } }, // fast mode
});
const [out] = await translator("Der Leuchtturm steht an der Küste.");
console.log(out.translation_text); // The lighthouse is on the coast.pip install onnxruntime sentencepiece numpy huggingface_hub
python scripts/translate.py OptimaMT/de-en "Der Leuchtturm steht an der Küste."pip install -r requirements.txt
python scripts/convert.py en-ar # rebuilds the decoder from Xenova's file: byte-identical to ours
python scripts/verify.py en-ar # same token ids as the original, both session settingsAll 49 repos: the OptimaMT collection, named OptimaMT/<source>-<target>.
| From | To |
|---|---|
| en | ar · de · es · fr · hi · id · it · nl · ru · uk · vi · zh |
| es | ar · de · en · fr · it · ru |
| fr | ar · de · en · es · ru |
| ar | de · en · es · fr |
| ru | en · es · fr · uk |
| de | en · es · fr |
| it | en · es · fr |
| nl | en · fr |
| uk | en · ru |
| zh · ja · pl · hi · id · vi · th · ko | en |
en-ar, en-zh, fr-ar and es-ar take a target token first (>>ara<<, >>cmn_Hans<<); use transformers.js 3.x for these.
Models: OPUS-MT (University of Helsinki), ONNX exports by Xenova, modified; CC BY 4.0 (NOTICE). Code: MIT (LICENSE).