Translation direction: English (en) -> Hausa (ha).
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.
fp32 is an exact reproduction of the original model. int8 dynamic
quantization causes real quality loss on this checkpoint - prefer fp32,
use int8 only where size is the binding constraint.
Selecting the language
Hausa has a native M2M100 language code (ha, unlike some of the other
Masakhane fine-tunes that reuse unrelated codes as stand-ins). 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"
Usage
python
1from transformers import AutoTokenizer
2from optimum.onnxruntime import ORTModelForSeq2SeqLM
34tok = AutoTokenizer.from_pretrained("TigreGotico/m2m100_418M_en_hau_rel_news_ft-onnx")5tok.src_lang ="en"6model = ORTModelForSeq2SeqLM.from_pretrained("TigreGotico/m2m100_418M_en_hau_rel_news_ft-onnx", use_cache=True, use_merged=False)78enc = tok("The weather is very nice today.", 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# -> A yau dai yanayi yana da kyau.