Downloads · 30 days
15
33% of all-time downloads
TigreGotico/m2m100_418M_en_ibo_rel_news_ft-onnx
m2m100_418M_en_ibo_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/m2m100418Meniborelnewsft.
Downloads · 30 days
15
33% of all-time downloads
All-time downloads
45
Public
Repo size
7.9 GB
Likes
0
Public
Click a slice to open those files.
.onnx7.9 GB · 100%
From the Hugging Face model README
ONNX export of masakhane/m2m100_418M_en_ibo_rel_news_ft.
Translation direction: English (en) -> Igbo (ig).
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_en_ibo_rel_news_ft \
--task text2text-generation-with-past --no-post-process <outdir>
| Path | Precision | Size |
|---|---|---|
*.onnx (root) | fp32 | 4.6 GB |
int8/*.onnx | int8 dynamic | 3.0 GB |
10 general-domain English sentences, PyTorch original vs ONNX, exact string
match against AutoModelForSeq2SeqLM.generate():
parity:
fp32_greedy: 1.00 # 10/10
fp32_beam4: 1.00 # 10/10
int8_greedy: 0.60 # 6/10
int8_beam4: 0.60 # 6/10
| Decoding | fp32 | int8 |
|---|---|---|
| greedy | 100% (10/10) | 60% (6/10) |
| beam=4 | 100% (10/10) | 60% (6/10) |
fp32 is an exact reproduction of the original model. int8 disagreements
were inspected by hand: most are minor diacritic/word-choice differences
(e.g. ị ga-enyere vs ị ga-enyere with one letter's tone mark differing),
one is a genuine paraphrase with a different but valid Igbo word for
"garden" (n'ime ubi = "in the farm" vs n'ogige ahụ = "in that garden").
No degenerate or garbled output was observed, but int8 quality loss on this
checkpoint is real and larger than on some of the other conversions in this
batch - prefer fp32 where quality matters.
Igbo has a native M2M100 language code (ig). The target is already fixed
via forced_bos_token_id in generation_config.json. You must still set
the source language on the tokenizer:
tokenizer.src_lang = "en"
from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("TigreGotico/m2m100_418M_en_ibo_rel_news_ft-onnx")
tok.src_lang = "en"
model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/m2m100_418M_en_ibo_rel_news_ft-onnx", use_cache=True, use_merged=False)
enc = tok("The weather is very nice today.", return_tensors="pt")
out = model.generate(**enc, num_beams=4, max_new_tokens=64)
print(tok.batch_decode(out, skip_special_tokens=True)[0])
# -> Oyi dị mma taa.
For the int8 build, pass subfolder="int8".