Downloads · 30 days
9
26% of all-time downloads
NazifToure/mbart-fr-fon-opus
mbart-fr-fon-opus is a translation model from NazifToure. Use it when you need text moved from one language to another. The card lists the license as mit.
This model is a fine-tuned mBart model for French to Fon translation, trained on the comprehensive OPUS dataset. It represents the first large-scale neural machine translation model for the French-Fon language pair.
Downloads · 30 days
9
26% of all-time downloads
All-time downloads
35
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
This model is a fine-tuned mBart model for French to Fon translation, trained on the comprehensive OPUS dataset. It represents the first large-scale neural machine translation model for the French-Fon language pair.
This model enables translation from French to Fon (a language primarily spoken in Benin). It was fine-tuned from the multilingual mBart-50 model using over 586,000 parallel sentence pairs from multiple OPUS corpora, making it the largest dataset used for French-Fon translation to date.
This model is intended for direct French-to-Fon translation tasks, including:
The model can be integrated into:
This model is not suitable for:
The model may exhibit biases present in the training data, which primarily consists of religious texts (JW materials) and web-scraped content. Performance may be limited on:
Users should be aware that translation quality may vary depending on text domain and should validate outputs, especially for official or sensitive communications.
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
# Load model and tokenizer
model = MBartForConditionalGeneration.from_pretrained("NazifToure/mbart-french-fon-opus")
tokenizer = MBart50TokenizerFast.from_pretrained("NazifToure/mbart-french-fon-opus")
def translate_fr_to_fon(text):
# Tokenize input
inputs = tokenizer(text, return_tensors="pt", max_length=128, truncation=True, padding=True)
# Get Fon language code
forced_bos = tokenizer.lang_code_to_id.get("fon_XX", None)
# Generate translation
outputs = model.generate(
**inputs,
forced_bos_token_id=forced_bos,
max_length=128,
num_beams=5,
early_stopping=True
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
# Example usage
french_text = "Bonjour, comment allez-vous ?"
fon_translation = translate_fr_to_fon(french_text)
print(f"French: {french_text}")
print(f"Fon: {fon_translation}")