CoolFace
Modelpublic

worldboss/nllb-200-distilled-600M-ewe

sourceHugging Facecc-by-nc-4.0updated 23d agoView on Hugging Face
0likes43downloads
Model Card

worldboss/nllb-200-distilled-600M-ewe

Fine-tuned facebook/nllb-200-distilled-600M for English → Ewe (eng_Latn → ewe_Latn).

Training data includes Ghana farmer Q&A, NLLB eng_Latn-ewe_Latn, and verse-aligned English–Ewe Bible from `ghananlpcommunity/ghana-corpus`. Farmer Q&A, NLLB, and the Bible corpus are CC-BY-NC.

Load and translate

python
import os
os.environ.setdefault("USE_TF", "0")

import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

repo = "worldboss/nllb-200-distilled-600M-ewe"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
dtype = torch.bfloat16 if device.type == "cuda" and torch.cuda.is_bf16_supported() else torch.float32

tokenizer = AutoTokenizer.from_pretrained(repo, src_lang="eng_Latn", tgt_lang="ewe_Latn")
model = AutoModelForSeq2SeqLM.from_pretrained(repo, dtype=dtype).to(device).eval()
forced_bos = tokenizer.convert_tokens_to_ids("ewe_Latn")

text = "How do I plant maize?"
inputs = tokenizer(text, return_tensors="pt").to(device)
with torch.inference_mode():
    out = model.generate(
        **inputs,
        forced_bos_token_id=forced_bos,
        num_beams=5,
        max_new_tokens=32,
    )
print(tokenizer.decode(out[0], skip_special_tokens=True))

Sample prompts:

  • —How do I plant maize?
  • —Keep the soil moist.
  • —When should I harvest the crops?

See translate_from_hub.ipynb in the training repo for the same questions.