Downloads · 30 days
24
28% of all-time downloads
Agricom/rw-agri-tts-nllb-finetuned
rw-agri-tts-nllb-finetuned is a translation model from Agricom. Use it when you need text moved from one language to another. The card lists the license as cc-by-4.0.
Finetuned translation model for English → Kinyarwanda, specialised for agriculture, insurance, finance and pension domains serving smallholder farmers in Rwanda.
Downloads · 30 days
24
28% of all-time downloads
All-time downloads
85
Public
Parameters
615M
2.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.5 GB · 99%
From the Hugging Face model README
Finetuned translation model for English → Kinyarwanda, specialised for agriculture, insurance, finance and pension domains serving smallholder farmers in Rwanda.
facebook/nllb-200-distilled-600Meng_Latn) → Kinyarwanda (kin_Latn)Standard translation models (including Google Translate) handle general Kinyarwanda adequately but struggle with domain-specific terminology used by smallholder farmers in Rwanda. This model was finetuned on curated domain-specific data covering:
| Source | Pairs | Purpose |
|---|---|---|
| Custom generated domain sentences (Mistral 7B) | 432 | Agriculture, insurance, finance, pensions |
| DigitalUmuganda general dataset (sampled) | 1,000 | General Kinyarwanda foundation |
| Total | 1,432 | Combined |
Domain sentences were generated, translated, back-translated and quality-filtered using BLEU scoring (threshold: 30). Only high-quality pairs were retained.
| Parameter | Value |
|---|---|
| Base model | facebook/nllb-200-distilled-600M |
| Epochs | 3 |
| Batch size | 4 (x4 gradient accumulation = 16 effective) |
| Max sequence length | 128 tokens |
| Optimizer | AdamW |
| Weight decay | 0.01 |
| Warmup steps | 100 |
| Hardware | NVIDIA T4 GPU |
| Training time | ~40 minutes |
| Metric | Score |
|---|---|
| BLEU (epoch 1) | 32.49 |
| BLEU (epoch 3) | 37.30 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
model_id = "Agricom/rw-agri-tts-nllb-finetuned"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
model.eval()
def translate(text: str) -> str:
tokenizer.src_lang = "eng_Latn"
tokenizer.tgt_lang = "kin_Latn"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
forced_bos_token_id = tokenizer.convert_tokens_to_ids("kin_Latn")
with torch.no_grad():
output = model.generate(
**inputs,
forced_bos_token_id = forced_bos_token_id,
max_length = 256,
num_beams = 4,
early_stopping = True,
)
return tokenizer.decode(output[0], skip_special_tokens=True)
# Example
text = "Apply fertilizer during the rainy season for better crop yield."
result = translate(text)
print(result)
# Output: Shyira ifumbire mugihe cyimvura kugirango umusaruro mwiza w'ibihingwa.
| English | Kinyarwanda |
|---|---|
| Apply fertilizer during the rainy season for better crop yield. | Shyira ifumbire mugihe cyimvura kugirango umusaruro mwiza w'ibihingwa. |
| Your insurance premium is due at the end of the month. | Inguzanyo yawe y'ubwishingizi igomba gutangwa mu mpera z'ukwezi. |
| Smallholder farmers can join the Umurenge SACCO to access loans. | Abahinzi bato bashobora kwifatanya na SACCO ya Umurenge kugirango babone inguzanyo. |
| Register for the RSSB pension scheme to secure your retirement. | Andika kuri gahunda ya penshoni ya RSSB kugirango ubone umudendezo wawe. |
| Store your maize in hermetic bags to reduce post-harvest losses. | Kubika ibigori byawe mu mifuka ya hermetic kugirango ugabanye igihombo nyuma y'isarura. |
If you use this model please cite:
@misc{agricom2024rwagrittsnllb,
title = {Kinyarwanda Agricultural Translation Model},
author = {Agricom},
year = {2024},
publisher = {HuggingFace},
url = {https://huggingface.co/Agricom/rw-agri-tts-nllb-finetuned}
}
For questions or collaboration: Agricom