galsenai/centralized_wolof_french_translation_data
Viewer โข Updated โข 98.3k โข 30 โข 2
How to use Lahad/nllb200-francais-wolof with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "translation" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("translation", model="Lahad/nllb200-francais-wolof") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("Lahad/nllb200-francais-wolof")
model = AutoModelForSeq2SeqLM.from_pretrained("Lahad/nllb200-francais-wolof", device_map="auto")A fine-tuned version of Meta's NLLB-200 (600M distilled) model specialized for French to Wolof translation. This model was trained to improve accessibility of content between French and Wolof languages.
Language Variety Limitations:
Technical Limitations:
Potential Biases:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Lahad/nllb200-francais-wolof")
model = AutoModelForSeq2SeqLM.from_pretrained("Lahad/nllb200-francais-wolof")
# Translation function
def translate(text, max_length=128):
inputs = tokenizer(
text,
max_length=max_length,
padding="max_length",
truncation=True,
return_tensors="pt"
)
outputs = model.generate(
input_ids=inputs["input_ids"],
attention_mask=inputs["attention_mask"],
forced_bos_token_id=tokenizer.convert_tokens_to_ids("wol_Latn"),
max_length=max_length
)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
For questions about this model, please create an issue on the model's Hugging Face repository.
Base model
facebook/nllb-200-distilled-600M