Downloads · 30 days
13
42% of all-time downloads
TigreGotico/m2m100_418M_fr_mos_rel_news_ft-onnx
m2m100_418M_fr_mos_rel_news_ft-onnx is a translation model from TigreGotico. Use it when you need text moved from one language to another. The card lists the license as afl-3.0.
ONNX export of masakhane/m2m100418Mfrmosrelnewsft.
Downloads · 30 days
13
42% of all-time downloads
All-time downloads
31
Public
Repo size
6 GB
Likes
0
Public
Click a slice to open those files.
.onnx6 GB · 100%
From the Hugging Face model README
ONNX export of masakhane/m2m100_418M_fr_mos_rel_news_ft.
Translation direction: French (fr) -> Mooré (Mossi) (mos).
The original model was trained by Masakhane
(masakhane-io/lafand-mt) as part of MAFAND-MT
(Adelani et al., NAACL 2022, "A Few Thousand Translations Go a Long Way!").
It is a fine-tune of facebook/m2m100_418M on JW300 plus the MAFAND news corpus.
Licence: AFL-3.0, as declared by the original repository. This repository only converts
the weights to ONNX. All credit for the model belongs to Masakhane.
optimum-cli export onnx --model masakhane/m2m100_418M_fr_mos_rel_news_ft \
--task text2text-generation-with-past --no-post-process <outdir>
| Path | Precision | Size |
|---|---|---|
*.onnx (root) | fp32 | 4754 MB |
int8/*.onnx | int8 dynamic | 1201 MB |
Encoder, decoder and decoder-with-past are separate graphs (--no-post-process);
the merged decoder is not produced because merging exhausts memory on this model.
8 sentences from the MAFAND-MT fr-mos test split,
PyTorch original vs ONNX, num_beams=4, max_new_tokens=64, exact string match:
This is a single-direction model. The target language is already fixed in
config.json via forced_bos_token_id, so you do not set it yourself.
You must set the source language on the tokenizer:
tokenizer.src_lang = "fr"
Masakhane reused existing M2M100 language tokens as stand-ins for languages M2M100
does not cover, so src_lang is "fr" here, which is not the ISO code of
French. Using a different value silently degrades output.
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("TigreGotico/m2m100_418M_fr_mos_rel_news_ft-onnx")
tok.src_lang = "fr"
model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/m2m100_418M_fr_mos_rel_news_ft-onnx")
enc = tok("Il a à son actif des propositions de systèmes pour répondre à des problèmes que le Burkina Faso rencontre.", return_tensors="pt")
out = model.generate(**enc, num_beams=4, max_new_tokens=64)
print(tok.batch_decode(out, skip_special_tokens=True)[0])
# -> A tʋʋmda ne no-rɩkds sẽn na n sõng n leok zu-loees nins Burkĩna Faso sẽn segdã.
For the int8 build, pass subfolder="int8".