drrobot9/nllb-yoruba-farming-finetuned
language:
- en
- yo tags:
- translation
- nllb
- yoruba
- agriculture
- nigerian-languages
- seq2seq license: cc-by-nc-4.0 basemodel: facebook/nllb-200-distilled-600M pipelinetag: translation ---
NLLB Yoruba Farming Fine-tuned
A fine-tuned version of facebook/nllb-200-distilled-600M specialised for English ↔ Yoruba translation in the Nigerian agricultural domain, built for FarmLingua AI by Kawafarm LTD.
Model Description
This model extends NLLB-200 with domain adaptation on Nigerian farming vocabulary, crop management terminology, livestock care, and agribusiness language. It is designed to produce natural, fluent Yoruba output for farming-related content generated by English-language LLMs.
Training Data
The farming pairs cover: rice, maize, cassava, yam, tomato, plantain, groundnut, cocoa, oil palm, cashew, ginger, catfish, poultry (broilers, layers), pigs, goats, dairy cattle, snail farming, bee farming, rubber tapping, and post-harvest management.
Training Details
Languages
Usage
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
model_id = "drrobot9/nllb-yoruba-farming-finetuned"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id).to("cuda")
model.eval()
def translate(text, src_lang="eng_Latn", tgt_lang="yor_Latn"):
tokenizer.src_lang = src_lang
inputs = tokenizer(text, return_tensors="pt", truncation=True).to("cuda")
forced_bos = tokenizer.convert_tokens_to_ids(tgt_lang)
with torch.no_grad():
output_ids = model.generate(
**inputs,
forced_bos_token_id=forced_bos,
num_beams=4,
max_new_tokens=256,
)
return tokenizer.batch_decode(output_ids, skip_special_tokens=True)[0]
# English → Yoruba
print(translate("How do I start a rice farm in Nigeria?"))
# Yoruba → English
print(translate(
"Bawo ni mo ṣe le bẹrẹ oko iresi ni Naijiria?",
src_lang="yor_Latn",
tgt_lang="eng_Latn"
))Intended Use
This model is a translation component within the FarmLingua AI pipeline:
User input (Yoruba/English)
↓
Language detection (facebook/fasttext-language-identification)
↓
Translation → English [this model]
↓
Qwen2.5-1.5B-Instruct (farming reasoning in English)
↓
Translation → Yoruba [this model]
↓
User receives answer in their language
## Limitations
- Optimised for **agricultural domain text** — general-purpose translation quality may vary
- Trained on **English ↔ Yoruba** only — does not handle Igbo or Hausa (use base NLLB for those)
- Yoruba tonal diacritics accuracy depends on training data quality
- Not intended for legal, medical, or financial translation
## Built By
**Kawafarm LTD** — *Empowering Nigerian farmers through AI*
> FarmLingua AI was built to help Nigerian farmers access agricultural knowledge in their local languages.
"""
# Write model card to output directory and push
with open(f"{OUTPUT_DIR}/README.md", "w", encoding="utf-8") as f:
f.write(model_card)
print("Model card written.")
# Push updated README to Hub
api.upload_file(
path_or_fileobj=f"{OUTPUT_DIR}/README.md",
path_in_repo="README.md",
repo_id=REPO_ID,
repo_type="model",
commit_message="Add model card",
token=TOKEN,
)
print(f"Model card pushed → https://huggingface.co/{REPO_ID}")Run this as a new cell after your upload cell. It writes the README.md locally and pushes it to the Hub in one step.
