CLIP icon indicating copy to clipboard operation
CLIP copied to clipboard

SSL certificate error when downloading model weights

Open linminhtoo opened this issue 2 years ago • 2 comments

I'm getting the below error when downloading model weights

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)>

Specifically I'm calling CLIP via llama-index and this is the full stack trace: https://gist.github.com/linminhtoo/b613ffc916e5e96329169e8b4601eff5

Any ideas? I'm on Mac and I could download other pretrained weights from HuggingFace etc without issues

linminhtoo avatar Dec 22 '23 08:12 linminhtoo

In file /Path/to/your/virtualenvs/envs/inpainting/lib/python3.8/site-packages/clip/clip.py temporarily modify the following lines:

with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:

to

import ssl 
context = ssl._create_unverified_context()
with urllib.request.urlopen(url, context=context) as source, open(download_target, "wb") as output:

CharlesNord avatar Feb 02 '24 08:02 CharlesNord

In file /Path/to/your/virtualenvs/envs/inpainting/lib/python3.8/site-packages/clip/clip.py temporarily modify the following lines:

with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:

to

import ssl 
context = ssl._create_unverified_context()
with urllib.request.urlopen(url, context=context) as source, open(download_target, "wb") as output:

Cool, that works. Because the 'clip' is installed from source code, I changed the source code /clip/clip.py@line59 before I install it

zyqhnu avatar Feb 20 '24 11:02 zyqhnu