Downloads · 30 days
15
19% of all-time downloads
MosesJoshuaCoker/text-to-text
text-to-text is a translation model from MosesJoshuaCoker. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as mit.
A bidirectional machine-translation model for Krio (the English-lexified creole spoken in Sierra Leone), fine-tuned from facebook/mbart-large-50-many-to-many-mmt. A single model translates English → Krio and Krio → En…
Downloads · 30 days
15
19% of all-time downloads
All-time downloads
79
Public
Parameters
611M
2.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.4 GB · 99%
From the Hugging Face model README
A bidirectional machine-translation model for Krio (the English-lexified
creole spoken in Sierra Leone), fine-tuned from
facebook/mbart-large-50-many-to-many-mmt.
A single model translates English → Krio and Krio → English.
Krio is not one of mBART-50's 50 supported languages, so a dedicated language
token kri_SL was added to the tokenizer (warm-started from the English
embedding en_XX) before fine-tuning.
en), Krio (kri)facebook/mbart-large-50-many-to-many-mmtTranslating short, everyday text between English and Krio — greetings, common phrases, basic conversational and informational sentences.
A starting checkpoint for further fine-tuning on larger or domain-specific English–Krio parallel data, or for back-translation pipelines that generate synthetic data to expand Krio resources.
Not suitable for high-stakes settings (medical, legal, safety-critical) without human review. Quality degrades on long, technical, or out-of-domain text, and on code-switched input. It does not translate languages other than English and Krio.
ɛ, ɔ)
and may not match other written conventions.Use human review for anything consequential, prefer short/simple inputs, and report chrF alongside BLEU since chrF is more reliable for low-resource, morphologically varied text.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
REPO = "MosesJoshuaCoker/mbart-large-50-krio" # update to your repo id
EN, KRI = "en_XX", "kri_SL"
tok = AutoTokenizer.from_pretrained(REPO)
model = AutoModelForSeq2SeqLM.from_pretrained(REPO)
# kri_SL is a custom language token, so it is not in lang_code_to_id after a
# fresh load — register it (and pass the id directly to forced_bos_token_id).
if KRI not in tok.lang_code_to_id:
tok.lang_code_to_id[KRI] = tok.convert_tokens_to_ids(KRI)
def translate(text, src_lang, tgt_lang, num_beams=5, max_new_tokens=96):
tok.src_lang = src_lang
enc = tok(text, return_tensors="pt")
out = model.generate(
**enc,
forced_bos_token_id=tok.convert_tokens_to_ids(tgt_lang),
num_beams=num_beams,
max_new_tokens=max_new_tokens,
)
return tok.batch_decode(out, skip_special_tokens=True)[0]
print(translate("Good morning, how are you?", EN, KRI)) # English -> Krio
print(translate("Aw yu de do?", KRI, EN)) # Krio -> English
MosesJoshuaCoker/krio_dataset_novax
— 1,943 parallel English↔Krio pairs (columns English, Krio), mostly short
phrases and everyday vocabulary.
forced_bos_token_id.kri_SL language token, resized embeddings, and warm-started it
from en_XX. Any orthographic characters not representable by the
SentencePiece vocab were added as tokens.facebook/mbart-large-50-many-to-many-mmt (~610M params)The held-out ~5% test split of MosesJoshuaCoker/krio_dataset_novax, evaluated
in both translation directions.
Decoding: beam search (num_beams=5).
TODO: paste the numbers printed by the notebook's evaluation cell.
| Direction | chrF | BLEU |
|---|---|---|
| English → Krio | TODO | TODO |
| Krio → English | TODO | TODO |
A compact bidirectional EN⇄Krio model. Given the small training set, treat chrF as the headline metric and expect best results on short, in-domain inputs.
Carbon emissions can be estimated with the Machine Learning Impact calculator (Lacoste et al., 2019).
mBART-50, a multilingual sequence-to-sequence Transformer (12-layer encoder /
12-layer decoder), trained with a token-level cross-entropy translation
objective. Source and target languages are specified with language-code tokens
(en_XX, kri_SL); the target language is forced at decode time via
forced_bos_token_id.
If you use this model, please cite the base model and dataset.
mBART-50 (base model):
@article{tang2020multilingual,
title={Multilingual Translation with Extensible Multilingual Pretraining and Finetuning},
author={Tang, Yuqing and Tran, Chau and Li, Xian and Chen, Peng-Jen and Goyal, Naman and Chaudhary, Vishrav and Gu, Jiatao and Fan, Angela},
journal={arXiv preprint arXiv:2008.00401},
year={2020}
}
Moses Joshua Coker
Via the Hugging Face repository: https://huggingface.co/MosesJoshuaCoker