galai
galai copied to clipboard
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
Hi all, I've tried to run galai on my mac (13.0.1 (22A400)) with Python 3.7 but unsuccessfully. When running the below program:
import galai as gal
if __name__ == '__main__':
model = gal.load_model("standard")
model.generate("Some example text")
I get the following error:
tokenizer.json: 0.00B [00:00, ?B/s]Incomplete files for tokenizer; downloading
tokenizer.json: 0.00B [00:00, ?B/s]
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1392, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 850, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1108, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/maorgoaz/projects/galactica/main.py", line 4, in <module>
model = gal.load_model("standard")
File "/Users/maorgoaz/projects/galactica/venv/lib/python3.7/site-packages/galai/__init__.py", line 37, in load_model
model._set_tokenizer(tokenizer_path=get_tokenizer_path())
File "/Users/maorgoaz/projects/galactica/venv/lib/python3.7/site-packages/galai/utils.py", line 144, in get_tokenizer_path
download_tokenizer(file_name)
File "/Users/maorgoaz/projects/galactica/venv/lib/python3.7/site-packages/galai/utils.py", line 84, in download_tokenizer
_download_file(TOKENIZER_URL, tokenizer_path)
File "/Users/maorgoaz/projects/galactica/venv/lib/python3.7/site-packages/galai/utils.py", line 73, in _download_file
urllib.request.urlretrieve(file_url, filename=file_loc, reporthook=t.update_to)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)>
Process finished with exit code 1
any ideas what's wrong?
For future viewers, I couldn't solve this issue without skipping SSL verification, so here's how to skip it:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
With the above code snippet:
import galai as gal
import ssl
if __name__ == '__main__':
ssl._create_default_https_context = ssl._create_unverified_context
model = gal.load_model("standard")
model.generate("Some example text")
Hi @maorgo, can you check if the problem still appears in galai version 1.1.0?
@mkardas Works great, thanks! Should I close this issue?