Views
No views yet
facebook/nllb-200-distilled-600M, specifically adapted for high-fidelity translation and instruction-following tasks in the Tumbuka (Chitumbuka) language, spoken primarily in Northern Malawi and Eastern Zambia.eng_Latn) to Tumbuka (tum_Latn), and Tumbuka Monolingual Instruction Tasking| English Input | Baseline NLLB / V1.0 Output | V2.0 Pure Tumbuka Output |
|---|---|---|
| Welcome to our home. | Takulandilani ku nyumba yithu (Nyanja leak) | Mwapokeleleka ku nyumba yithu |
| We need reliable irrigation for our farms. | Tikukhumba maji ghakukhora... | Tikukhumba maji ghakugomezgeka ghakuthira minda yithu |
| Good morning, how are you today? | Mulenji uwemi... | Mulenji uwemi, muli wuli mwahuno? |
| Who are you? | Kasi ndiwe njani? | Kasi ndiwe njani? |
transformers library for inference.1import torch
2from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
4model_id = "SaintsStudios/tumbuka_nllb-200"
5
6print("Loading model and tokenizer...")
7tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
8model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
9
10device = "cuda" if torch.cuda.is_available() else "cpu"
11model.to(device)
12
13def translate_to_tumbuka(text: str):
14 # Set the language configs
15 tokenizer.src_lang = "eng_Latn"
16 inputs = tokenizer(text, return_tensors="pt").to(device)
17
18 # Force target generation to start with the Tumbuka language token
19 forced_bos_token_id = tokenizer.convert_tokens_to_ids("tum_Latn")
20
21 translated_tokens = model.generate(
22 **inputs,
23 forced_bos_token_id=forced_bos_token_id,
24 max_length=128,
25 num_beams=4,
26 early_stopping=True
27 )
28
29 return tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
30
31# Test run
32sample_text = "Let us learn together."
33output = translate_to_tumbuka(sample_text)
34print(f"English: {sample_text}")
35print(f"Tumbuka: {output}")
36# Output: Tiyeni tisambire pamoza
37
38
39Training Hyperparameters (V2.0)
40Dataset Blend: 50% Translation Pairs / 50% Monolingual Alpaca Instruction Datasets
41
42- Epochs: 3
43- Learning Rate: 2e-5
44- Optimizer: Adafactor
45- Batch Size: 2 (Gradient Accumulation Steps: 8)
46- Precision: FP16 Mixed Precision
47- Hardware: Kaggle Cloud Compute (GPU T4)
48
49Acknowledgements
50Special thanks to the open-source contributors maintaining datasets for Malawian localized languages, making high-quality regional adaptation pipelines possible.