This is an English to Kinyarwanda translation model fine-tuned from the NLLB (No Language Left Behind) model family. It's specifically optimized for translating English text to Kinyarwanda with high accuracy and cultural appropriateness.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("Maxime-Bakunzi/twigane-en-kin-translation")
model = AutoModelForSeq2SeqLM.from_pretrained("Maxime-Bakunzi/twigane-en-kin-translation")
def translate_en_to_rw(text):
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
outputs = model.generate(**inputs, max_length=512, num_beams=4, early_stopping=True)
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
return translation
# Example usage
english_text = "Hello, how are you today?"
kinyarwanda_translation = translate_en_to_rw(english_text)
print(kinyarwanda_translation) # Expected: "Muraho, amakuru yawe?"
If you use this model, please cite:
@misc{twigane-translation-model,
author = {Twigane Project},
title = {English to Kinyarwanda Translation Model},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/Maxime-Bakunzi/twigane-en-kin-translation}
}
model-00001-of-00002.safetensors 5.0 GBmodel-00002-of-00002.safetensors 483 MB