SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /dslim/bert-base-NER/resolve/main/tokenizer_config.json
Full error message
I am facing below issue while loading the pretrained BERT model from HuggingFace due to SSL certificate error.
Error:
SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /dslim/bert-base-NER/resolve/main/tokenizer_config.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)')))
The line that is causing the issue is:
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
Source code:
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
model = AutoModelForTokenClassification.from_pretrained("dslim/bert-base-NER")
I am expecting to download pre-trained models while running the code in jupyter lab on Windows.Solutionsource: stackoverflow \u2197
A working solution to this is the following: 1) pip install requests==2.27.1 Please note that both prerequisites need to take place, just running the following code will not work unless you have that specific version of requests (I had to downgrade in my case from 2.29.0 to 2.27.1. 2) import os os.environ['CURL_CA_BUNDLE'] = ''
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/9c2ecd162c4706638c86f08989ada88ea630312a52bd2b5bf5ab115c80cad9a3hash \u00b7 9c2ecd162c4706638c86f08989ada88ea630312a52bd2b5bf5ab115c80cad9a3