Translation
Transformers
PyTorch
Safetensors
Yoruba
English
marian
text2text-generation
text
machine-translation
language-translation
seq2seq
helsinki-nlp
Instructions to use kingabzpro/Helsinki-NLP-opus-yor-mul-en with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kingabzpro/Helsinki-NLP-opus-yor-mul-en 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="kingabzpro/Helsinki-NLP-opus-yor-mul-en")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("kingabzpro/Helsinki-NLP-opus-yor-mul-en") model = AutoModelForSeq2SeqLM.from_pretrained("kingabzpro/Helsinki-NLP-opus-yor-mul-en") - Notebooks
- Google Colab
- Kaggle
Predicting English Translation
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Loading tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("kingabzpro/Helsinki-NLP-opus-yor-mul-en")
model = AutoModelForSeq2SeqLM.from_pretrained("kingabzpro/Helsinki-NLP-opus-yor-mul-en").to('cuda')
# Prediction
a = model.generate(**tokenizer.prepare_seq2seq_batch('Nínú ìpè kan lẹ́yìn ìgbà náà, wọ́n sọ fún aṣojú iléeṣẹ́ BlaBlaCar pé ètò náà ti yí padà, pé',return_tensors='pt').to('cuda'))
text = tokenizer.batch_decode(a)
# Cleaning text
text = str(text)
text = re.sub("<pad> ","",text)
text = re.sub("'","",text)
text = text.replace("[", "")
text = text.replace("]", "")
text
Result
'In a statement after that hearing, the BualaCard’s representative was told that the event had changed, that he had turned up.'
ROGUE Score
0.3025
- Downloads last month
- 10