Helsinki-NLP/kde4
Updated • 828 • 25
How to use yasmineelabbar/marian-finetuned-kde4-en-to-fr-accelerate 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="yasmineelabbar/marian-finetuned-kde4-en-to-fr-accelerate") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("yasmineelabbar/marian-finetuned-kde4-en-to-fr-accelerate")
model = AutoModelForSeq2SeqLM.from_pretrained("yasmineelabbar/marian-finetuned-kde4-en-to-fr-accelerate", device_map="auto")This model is a fine-tuned MarianMT model for English to French translation. It has been trained using the KDE4 dataset and optimized for translation tasks.
During training and evaluation, the model achieved a BLEU score of 52.98 on the validation dataset. The BLEU score is a measure of translation quality, with higher scores indicating better translation performance.
You can use this model for translating English sentences to French. Below is a sample code snippet for translating a sentence using the model:
from transformers import pipeline
model_checkpoint = "yasmineelabbar/marian-finetuned-kde4-en-to-fr-accelerate"
translator = pipeline("translation", model=model_checkpoint)
result = translator("Input sentence in English")
print(result)