SSLCertVerificationError when loading a model

I am exploring potential opportunities of using HuggingFace “Transformers”.

I have been trying check some basic examples from the introductory course, but I came across a problem that I have not been able to solve. I have successfully installed transformers on my laptop using pip, and I have tried to run your “sentiment-analysis” example using Jupyter Notebook, Spider, or Python Command Line.

I am running Python 3.8.5 on Windows 10 behind a company firewall:

  • transformers version: 4.12.3
  • Platform: Windows-10-10.0.19041-SP0
  • Python version: 3.8.5
  • PyTorch version (GPU?): not installed (NA)
  • Tensorflow version (GPU?): 2.7.0 (False)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?: NO
  • Using distributed or parallel set-up in script?: NO

When I do:

from transformers import pipeline

I get no errors, but when I try:

classifier = pipeline(“sentiment-analysis”)

I get:

No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english (distilbert-base-uncased-finetuned-sst-2-english · Hugging Face)
HTTPSConnectionPool(host=‘huggingface.co’, port=443): Max retries exceeded with url: /distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)’)))

followed by a long detailed traceback for SSLCertVerificationError

Any advice on how to proceed?

Thanks a lot
Miroslaw Bartkowiak

I’m also getting the same error. Please let me know if any one has resolution for this?

I am getting the same error. Any help here would be much appreciated!

I also have same problem.
anybody solve it?

Same issue while downloading LLAMA 7B.

model_id='meta-llama/Llama-2-7b-hf'
Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))"), '(Request ID: 0c7dac02-e1e6-4de6-a585-0e9581c4a24f)')

Anyone knows how to fix this. I am on a Mac machine.

Try to run this: pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user pip-system-certs