Translation direction: Luganda (lg) -> English (en).
Attribution
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.
10 general-domain Luganda sentences (source language for this lg->en
pair), PyTorch original vs ONNX, exact string match against
AutoModelForSeq2SeqLM.generate().
fp32 is an exact reproduction of the original model. int8 disagreements
were inspected by hand and are paraphrases (e.g. ref "We need to talk
about the coming year's budget." vs int8 "We have to talk about the
coming year's budget.").
Caveat on sample size: n=10 exact-match is a small, noisy estimate,
not a FLORES-scale benchmark. A separate measurement campaign on this
project found n=5 exact-match numbers for another model swing from 100%
to 14% when re-measured at n=100 on FLORES-200. Treat the percentages
above as an initial signal only - a proper FLORES + chrF evaluation
supersedes it wherever available.
Selecting the language
Luganda has a native M2M100 language code (lg). 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 = "lg"
Usage
python
1from transformers import AutoTokenizer
2from optimum.onnxruntime import ORTModelForSeq2SeqLM
34tok = AutoTokenizer.from_pretrained("TigreGotico/m2m100_418M_lug_en_rel_news_ft-onnx")5tok.src_lang ="lg"6model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/m2m100_418M_lug_en_rel_news_ft-onnx", use_cache=True, use_merged=False)78enc = tok("Embeera y'obudde nnungi nnyo leero.", return_tensors="pt")9out = model.generate(**enc, num_beams=4, max_new_tokens=64)10print(tok.batch_decode(out, skip_special_tokens=True)[0])11# -> The climate is very good today.