Exception: Helsinki-NLP/opus-mt-no-en is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'

Hi All,
I’m very inexperienced at coding, but I’m trying to machine translate using NMT some sentences for a Political Science article I am writing. And for many quasi sentences I am encountering the following:

Exception: Helsinki-NLP/opus-mt-no-en is not a local folder and is not a valid model identifier listed on ‘Models - Hugging Face
If this is a private repository, make sure to pass a token having permission to this repo with use_auth_token or log in with huggingface-cli login and pass use_auth_token=True.

Does anyone have any advice? I am using RStudio and the reticulate package. This is the very basic python code I have written:

from easynmt import EasyNMT
model = EasyNMT(‘opus-mt’, max_loaded_models=10)

def translate(text, lang):
if(lang != ‘english’):
return model.translate(text, target_lang=‘en’)
return text

I encountered the issue for most Norwegian sentences I was trying to translate, but sporadically for other languages I am encountering the same…

Any help would be very much appreciated!

1 Like

Hey! I am facing the same trouble. Were you able to fix it?

hey im facing same issue is there any update on this ?

@Rootx007 @Sayart @nikkiBot
well this is not related to :hugs: but let’s try to break it down.
what the EasyNMT library does is that whenever a new text is passed to the model it will do the following identify input language example :

  • for Norwegian language = no

and you already selected the output language in here

  • output language is en

now EasyNMT library does is that combines these together

model = "Helsinki-NLP/opus-mt-" + "no" + "-" + "en"
model =  "Helsinki-NLP/opus-mt-no-en"
url = "https://huggingface.co/Helsinki-NLP/opus-mt-no-en"
# oops url does not exist

now it will search huggingface for the corresponding model, and since Helsinki-NLP did not upload any no-en model this will ofc generate a problem since the model does not exist in huggingface in the first place.

====================================================

another example that is working for french and english is this model (french to english)

input_language = "fr" 
output_language = "en"
full_model = "Helsinki-NLP/opus-mt-fr-en"
url = "https://huggingface.co/Helsinki-NLP/opus-mt-fr-en"
# then `EasyNMT` downloads the model

TLDR;
Helsinki-NLP did not upload opus-mt-no-en model and this does not have anything to do with huggingface.