Downloads · 30 days
35
6% of all-time downloads
cibfaye/nllb-fr-wo
nllb-fr-wo is a machine learning model from cibfaye. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
This model is a fine-tuned version of facebook/nllb-200-distilled-600M on the galsenai/french-wolof-translation dataset. It is designed to perform translation from French to Wolof.
Downloads · 30 days
35
6% of all-time downloads
All-time downloads
589
Public
Parameters
615M
2.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors2.5 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of facebook/nllb-200-distilled-600M on the galsenai/french-wolof-translation dataset. It is designed to perform translation from French to Wolof.
The model was evaluated on a subset of 50 lines from the test split of the galsenai/french-wolof-translation dataset. The evaluation metric used was BLEU score, computed using the sacrebleu library.
BLEU score: 9.17
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "cibfaye/nllb-fr-wo"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
def translate(text, src_lang='fra_Latn', tgt_lang='wol_Latn', a=32, b=3, max_input_length=1024, num_beams=5, **kwargs):
tokenizer.src_lang = src_lang
tokenizer.tgt_lang = tgt_lang
inputs = tokenizer(text, return_tensors='pt', padding=True, truncation=True, max_length=max_input_length)
result = model.generate(
**inputs.to(model.device),
forced_bos_token_id=tokenizer.convert_tokens_to_ids(tgt_lang),
max_new_tokens=int(a + b * inputs.input_ids.shape[1]),
num_beams=num_beams,
**kwargs
)
return tokenizer.batch_decode(result, skip_special_tokens=True)
text = "Votre texte en français ici."
translation = translate(text)
print(translation)