CompVis / stable-diffusion

A latent text-to-image diffusion model
https://ommer-lab.com/research/latent-diffusion-models/
Other
68.59k stars 10.19k forks source link

I have an error at runtime as if the local runtime needs access to a third party? #128

Open Tomorrowxxy opened 2 years ago

Tomorrowxxy commented 2 years ago
(ldm) usdr@VM-48-5-centos /opt/project/stable (main?) $ python ./scripts/txt2img.py --prompt "An astronaut on horseback" --plms --outdir ./result --ckpt ./models/ldm/stable-diffusion-v1/sd-v1-4.ckpt --ddim_steps 100 --H 512 --W 512 --seed 8
Traceback (most recent call last):
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/connectionpool.py", line 700, in urlopen
self._prepare_proxy(conn)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/connectionpool.py", line 996, in _prepare_proxy
conn.connect()
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/home/usdr/.conda/envs/ldm/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
socket.timeout: _ssl.c:1106: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /CompVis/stable-diffusion-safety-checker/resolve/main/preprocessor_config.json (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1106: The handshake operation timed out')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/transformers/feature_extraction_utils.py", line 403, in get_feature_extractor_dict
resolved_feature_extractor_file = cached_path(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/transformers/utils/hub.py", line 282, in cached_path
output_path = get_from_cache(
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/transformers/utils/hub.py", line 485, in get_from_cache
r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/requests/api.py", line 100, in head
return request("head", url, **kwargs)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/requests/adapters.py", line 559, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /CompVis/stable-diffusion-safety-checker/resolve/main/preprocessor_config.json (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1106: The handshake operation timed out')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./scripts/txt2img.py", line 27, in <module>
    safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id)
    File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/transformers/models/auto/feature_extraction_auto.py", line 270, in from_pretrained
    config_dict, _ = FeatureExtractionMixin.get_feature_extractor_dict(pretrained_model_name_or_path, **kwargs)
    File "/home/usdr/.conda/envs/ldm/lib/python3.8/site-packages/transformers/feature_extraction_utils.py", line 443, in get_feature_extractor_dict
    raise EnvironmentError(
    OSError: Can't load feature extractor for 'CompVis/stable-diffusion-safety-checker'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'CompVis/stable-diffusion-safety-checker' is the correct path to a directory containing a preprocessor_config.json file

Why do you need to visit huggingface.co? How to deal with this problem?

hx3333 commented 2 years ago

I got the same issue, pls help..

hx3333 commented 2 years ago

I have solve this problem.You should download the file from huggingface.co, and make a local file:CompVis/stable-diffusion-safety-checker

o5f2y commented 2 years ago

I have solve this problem.You should download the file from huggingface.co, and make a local file:CompVis/stable-diffusion-safety-checker

put the json file and Compvis/stable-diffusion-safety-checker same place?