--- license: mpl-2.0 tags: - translation - onnx - offline_translate --- # offline_translate model bundles int8 ONNX translation models packaged for the [`offline_translate`](https://pub.dev/packages/offline_translate) Flutter package: neural machine translation that runs entirely on a phone, with no network access of any kind once a model is installed. Each direction lives in its own directory: ```text /manifest.json metadata, architecture constants, SHA-256 per file /encoder.onnx graph /encoder.data int8 encoder weights (memory-mapped at runtime) /decoder.onnx graph, with a greedy `next_token` output built in /decoder.data int8 decoder weights /embedding.data the tied embedding, shared by both graphs (tiny-ssru) /source.spm upstream SentencePiece model, unmodified /vocab.json upstream shared vocabulary, unmodified (marian only) ``` Use them with: ```dart final translator = await OfflineTranslator.initialize( languages: {Language.en, Language.fr}, defaultLanguage: Language.fr, modelSource: HttpModelSource.official(), ); await translator.installModel(from: Language.en, to: Language.fr); final result = translator.translate('Hello, how are you?'); print(result.translatedText); // Bonjour, comment allez-vous ? ``` Every file is verified against the SHA-256 in its manifest before the model is moved into place, so the transport does not have to be trusted beyond TLS. ## Directions | Direction | Size | Family | Vocab | Upstream | License | |---|---:|---|---:|---|---| | `de-en` | 32.3 MB | tiny-ssru | 32000 | mozilla/firefox-translations-models base-memory/deen | MPL-2.0 | | `en-de` | 32.3 MB | tiny-ssru | 32000 | mozilla/firefox-translations-models base-memory/ende | MPL-2.0 | | `en-es` | 32.3 MB | tiny-ssru | 32000 | mozilla/firefox-translations-models base-memory/enes | MPL-2.0 | | `en-fr` | 32.3 MB | tiny-ssru | 32000 | mozilla/firefox-translations-models base-memory/enfr | MPL-2.0 | | `es-en` | 32.3 MB | tiny-ssru | 32000 | mozilla/firefox-translations-models base-memory/esen | MPL-2.0 | | `fr-en` | 32.3 MB | tiny-ssru | 32000 | mozilla/firefox-translations-models base-memory/fren | MPL-2.0 | ## Licensing These are **modified** weights: converted to ONNX, dynamically quantised to int8, and extended with a greedy arg-max output node. The conversion pipeline is `tool/build_tiny_model.py` (and `tool/build_model.py` for the `marian` family) in the package repository — that, plus the upstream checkpoint, is the source form. * **MPL-2.0** — `de-en`, `en-de`, `en-es`, `en-fr`, `es-en`, `fr-en`. File-level copyleft: applications that merely *use* these files are unaffected and keep their own licence. Anyone **redistributing** them must keep them under MPL-2.0 and make the source form available. Upstream projects: > Mozilla. *Firefox Translations models.* > — MPL-2.0. > Jörg Tiedemann and Santhosh Thottingal. *OPUS-MT — Building open translation > services for the World.* EAMT 2020, Lisbon, Portugal.