AfriSpeech/afrigloss-opus-mt-fr-ha is a production glossary-constrained machine translation model for French $\rightarrow$ Hausa, fine-tuned under the Afri-Gloss-MT framework.
Part of the Afri-Gloss-MT Models Collection.
<target_term>) inside the source sentence, and reliably preserves them in the generated translation.AfriSpeech/africa-corpus and AfriSpeech/african-corpus-jw with 100% verified in-place noun-chunk replacements.transformers)from transformers import MarianMTModel, MarianTokenizer
model_name = "AfriSpeech/afrigloss-opus-mt-fr-ha"
tokenizer = MarianTokenizer.from_pretrained(model_name)
model = MarianMTModel.from_pretrained(model_name)
# 1. Plain source sentence with in-place target glossary insertion
prompt = "The <malam> brought <salama> and <farin ciki> to the children."
inputs = tokenizer(prompt, return_tensors="pt", padding=True)
translated_tokens = model.generate(**inputs, max_length=128, num_beams=4)
translation = tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
print("Output Translation:", translation)
# Output preserves the injected terms fluently!
This model was trained on the hau subset of the official dataset:
"ha"@article{owusu2026afrigloss,
title={Afri-Gloss-MT: In-Place Glossary Constraints for African Machine Translation},
author={Owusu, Mich-Seth},
journal={arXiv preprint},
year={2026}
}
model.safetensors 299 MBtraining_args.bin 5 kB