Error We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}

Hi,

I am new to Hugging Face and would like to try out some models. I had no problems running the examples mentioned in the course. For example, with:

from transformers import pipeline

classifier = pipeline("sentiment-analysis") 
res=classifier("I've been waiting for a HuggingFace course my whole life.")

Everything went fine. The model was downloaded to the cache, and the classification was done.

Now, I would like to try out a summarization task:

summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
    summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
    return summary[0]['summary_text']

Running this script always results in an error:

We couldn’t connect to ‘{HUGGINGFACE_CO_RESOLVE_ENDPOINT}’ to load this model, couldn’t find it in the cached "
OSError: We couldn’t connect to ‘https://huggingface.co’ to load this model, couldn’t find it in the cached files and it looks like distilbert/distilbert-base-uncased-finetuned-sst-2-english is not the path to a directory containing a {configuration_file} file.
Checkout your internet connection or see how to run the library in offline mode at ‘Installation

I have an internet connection. Deleting the cache and starting the first example (classifier) again downloads the model. Even omitting the model for the summarization task leads to the above-mentioned error.

Could someone please tell me where I am going wrong?

Thanks,
Wanda

1 Like

Hmm… It works.

from transformers import pipeline
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
summary = summarizer("I've been waiting for a HuggingFace course my whole life.", max_length=130, min_length=30, do_sample=False)
print(summary[0]['summary_text']) # "I've been waiting for a HuggingFace course my whole life. I'm so excited," she said. "It's been a long time coming"

Edit:
Network connection issue or something, for example? Connection Error · Issue #2319 · huggingface/huggingface_hub · GitHub