Facing SSL Error with Huggingface pretrained models
Full error message
I am facing below issue while loading the pretrained model from HuggingFace.
HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /roberta-base/resolve/main/config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))
The line that is causing the issue is
tokenizer = AutoTokenizer.from_pretrained('roberta-base')
I never faced this issue before and it was working absolutely fine earlier. I am clueless.Solutionsource: stackoverflow \u2197
Adding the following to the top of the code worked for me: import requests from huggingface_hub import configure_http_backend def backend_factory() -> requests.Session: session = requests.Session() session.verify = False return session configure_http_backend(backend_factory=backend_factory)
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/b45c42b0624ca3b2c3f8e09469a285d57d7cb1dddb86f1cda34f31ad5a7c1ff0hash \u00b7 b45c42b0624ca3b2c3f8e09469a285d57d7cb1dddb86f1cda34f31ad5a7c1ff0