SSLCertVerificationError while using Bert in ktrain package

Viewed 679

I am using the ktrain package in jupyter with code supplied from this notebook. I get an error at the line qa = text.SimpleQA(INDEXDIR). The error is long but a shortened version is as follows:

HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-large-uncased-whole-word-masking-finetuned-squad/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)')))
HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-large-uncased-whole-word-masking-finetuned-squad/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)')))

OSError: Can't load config for 'bert-large-uncased-whole-word-masking-finetuned-squad'. Make sure that:

- 'bert-large-uncased-whole-word-masking-finetuned-squad' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'bert-large-uncased-whole-word-masking-finetuned-squad' is the correct path to a directory containing a config.json file

I can access https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json on my browser. I'm quite at a loss for what to do - my coding skills are minimal at best so any and all suggestions would be much appreciated.

1 Answers

My guess is that your corporate intranet is inserting a "man in the middle" on all https traffic. I'm guessing the following will give you the same error right now:

import requests
requests.get('https://www.huggingface.co')

If you get a CA certificate bundle from your IT department and you are on Windows, you can try this:

import os
os.environ['REQUESTS_CA_BUNDLE'] = 'path/to/certificates_ca_bundle.crt'
qa = text.SimpleQA(INDEXDIR)

If on Linux, install the certificates using these instructions.

Related