Xenova/opus-mt-fr-en
Helsinki-NLP/opus-mt-fr-en
translation
1. Live French → English Translator
encoder_model_quantized.onnx
(50.09 MB) + decoder_model_merged_quantized.onnx (57.38 MB) via the shared
Transformers.js 3.7.5 runtime inside a dedicated Web Worker. Text and uploaded files stay in
your browser.
Pick a curated French register, type your own French text, or upload a local
.txt / .srt / .md document:
French Input
English Translation (Live MarianMT)
2. Sentence Alignment (French-Aware Splitter)
With Sentence alignment on, splitFrenchSentences() keeps
M., Mme., Dr., etc., p. ex. and
c.-à-d. intact, honours French spaced punctuation (Bonjour !) and closing
« … » guillemets, then translates each sentence with its own token counts and latency.
| # | French Source Sentence | English Translation | Tokens (In → Out) | Latency |
|---|---|---|---|---|
| Run a translation above to inspect sentence alignment. | ||||
3. See Inside: Word-Level SentencePiece Fertility
What am I looking at? The live tokenizer output for your French source, regrouped
into surface words. Each pill shows the word, the pieces it became and its fertility
(×n pieces). Elided clitics such as l' / qu' and rare accented
or slang words fragment more (amber ≥ 2, red ≥ 4). The pipeline does not expose cross-attention
weights, so this is a tokenizer view, not an attention alignment.
Fertility ratio (pieces per French word) will appear after translation.
4. Why It Matters
A 107 MB, Apache-2.0 French → English model that runs offline after one download turns bilingual workflows into zero-server features. You could build:
Support inbox triage
Translate incoming French/Québécois tickets before an English-only classifier routes them (see Multi-model).
Subtitle localisation
Re-time-safe .srt translation for French films and webinars without uploading scripts (see Practical).
Reading assistant
Sentence-aligned glosses for learners, with faux-amis warnings (see Wild).
Private document review
Contracts, HR letters and medical notes translated on-device for GDPR-sensitive teams.
5. How the API Works & Source Code
Trained by the Language Technology Research Group at the University of Helsinki
(Helsinki-NLP/opus-mt-fr-en, Apache-2.0) on OPUS French–English data and converted
to quantized ONNX by Xenova (Xenova/opus-mt-fr-en). The whole call is
pipeline("translation", "Xenova/opus-mt-fr-en", { device: "wasm", dtype: "q8" })
followed by pipe(text, { num_beams, max_new_tokens }).
Show the code — worker.js runSingleTranslation(): one MarianMT WASM q8 translation with live SentencePiece counts
Show the code — opus-fr-core.mjs splitFrenchSentences(): M. / Mme. / etc. / « guillemets »-aware splitter
Show the code — opus-fr-core.mjs groupPiecesIntoWords(): regroup ▁ pieces into per-word fertility
6. Use Cases & References
- Basics — beam ladder 1 / 2 / 4 with word diffs, plus elision & accent tokenization.
- Practical — cinema
.srt, support.csvand business.txtbatch translation with lossless exports. - Wild — faux amis grading, Québec vs Paris and tu/vous register stress tests.
- Multi-model — French ticket → English → zero-shot queue & tone triage.
- Helsinki-NLP/opus-mt-fr-en model card · OPUS-MT project · Transformers.js TranslationPipeline docs