do:
model, _, _ = open_clip.create_model_and_transforms("ViT-H-14", device="cpu", pretrained="laion2b_s32b_b79k", cache_dir="/data/work/StableSR-main/")
error:
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/opt/conda/lib/python3.8/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/opt/conda/lib/python3.8/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /laion/CLIP-ViT-H-14-laion2B-s32B-b79K/resolve/main/open_clip_pytorch_model.bin (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/opt/conda/lib/python3.8/site-packages/open_clip/factory.py", line 151, in create_model_and_transforms
model = create_model(
File "/opt/conda/lib/python3.8/site-packages/open_clip/factory.py", line 113, in create_model
checkpoint_path = download_pretrained(pretrained_cfg, cache_dir=cache_dir)
File "/opt/conda/lib/python3.8/site-packages/open_clip/pretrained.py", line 295, in download_pretrained
target = download_pretrained_from_hf(model_id, cache_dir=cache_dir)
File "/opt/conda/lib/python3.8/site-packages/open_clip/pretrained.py", line 265, in download_pretrained_from_hf
cached_file = hf_hub_download(model_id, filename, revision=revision, cache_dir=cache_dir)
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 120, in _inner_fn
return fn(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1166, in hf_hub_download
metadata = get_hf_file_metadata(
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 120, in _inner_fn
return fn(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1498, in get_hf_file_metadata
r = _request_wrapper(
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 407, in _request_wrapper
response = _request_wrapper(
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 442, in _request_wrapper
return http_backoff(
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_http.py", line 129, in http_backoff
response = requests.request(method=method, url=url, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/opt/conda/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /laion/CLIP-ViT-H-14-laion2B-s32B-b79K/resolve/main/open_clip_pytorch_model.bin (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))
To download the model in the installation environment, the code must first access the network to know the specific path of the model.
So do we also need to connect our local models to the internet?
And I have downloaded the relevant models locally, but the code still needs to try to access the network
open_clip/factory.py:113~115 lines
I suggest that the logical order of the code should be changed.
hi have you solved the problem?
Hi all. Probably the simplest thing to do here is to manually download the checkpoint and then point to the checkpoint itself when loading the model (see https://github.com/mlfoundations/open_clip/#loading-models). If that doesn't work for you let me know and I'll look more into it