Lighter OPUS-MT translation models that run locally, in ONNX Runtime or in the browser with transformers.js. 51 translation directions, the same translations, and about half the memory in fast mode.
All 51 models Interactive results and live demo Method and code Technical report
| Memory after load (median; Linux 51 pairs, Windows 49) | Linux | Windows |
|---|---|---|
Fast mode (disable_quant_qdq = 1) | 525 → 281 MiB (-46 %) | 500 → 257 MiB (-49 %) |
| ONNX Runtime defaults | 277 → 217 MiB (-22 %) | 196 → 166 MiB (-16 %) |
Identical output on FLORES-200 devtest for every pair, so identical BLEU and chrF.
Quick start
import { pipeline } from "@huggingface/transformers";
const translator = await pipeline("translation", "OptimaMT/en-ar", {
dtype: "q8",
session_options: { extra: { session: { disable_quant_qdq: "1" } } }, // fast mode
});
console.log((await translator("The lighthouse stands on the coast."))[0].translation_text);
Used in production: OpenCircle, a desktop screen translator for Windows and Linux, ships these models since v0.1.4.
Models: CC BY 4.0 (OPUS-MT by the University of Helsinki; ONNX exports by Xenova, modified). Code: MIT.