Hi,
I’d be happy to see a code example for translation mechanism from es-en and back from en-es.
I tried using the code for en-ROMANCE, and change the model to opus-mt-en_el_es_fi-en_el_es_fi but I’m getting empty string for the tgt_text.
the code published here:
https://huggingface.co/transformers/model_doc/marian.html 7
from transformers import MarianMTModel, MarianTokenizer
src_text = [
‘>>fr<< this is a sentence in english that we want to translate to french’,
‘>>pt<< This should go to portuguese’,
‘>>es<< And this to Spanish’
]
model_name = ‘Helsinki-NLP/opus-mt-en-ROMANCE’
tokenizer = MarianTokenizer.from_pretrained(model_name)
print(tokenizer.supported_language_codes)
model = MarianMTModel.from_pretrained(model_name)
translated = model.generate(**tokenizer.prepare_translation_batch(src_text))
tgt_text = [tokenizer.decode(t, skip_special_tokens=True) for t in translated]
Thank you 
Shani