OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json. Checkout 'https://huggingface.co/CompVis/stable-diffusion-v1-4/None' for available files.

#238
by Lily0512 - opened

OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json. Checkout 'https://huggingface.co/CompVis/stable-diffusion-v1-4/None' for available files.
HELP!!!!!!!!!!

@Lily0512 Hey! I have the same issue. I have researched the issue online and someone said it can be solved by updating the transformers to the latest version. But I have the version of 4.36.0 and it still happened. Do you solve the question? If you've worked it out, could you please tell me the solution?

Hi. Do you happen to have a local directory whose path is like ./CompVis/stable-diffusion-v1-4?

Also, we can help only if you provide a reproducible code snippet.

@ydshieh No, I don't have a local dictionary, my code snippet as following
class StableDiffusion(nn.Module):
def init(self, device, sd_version='1.4', hf_key=None, step_range=[0.2, 0.6]):
super().init()

    self.device = device
    self.sd_version = sd_version

    print(f'[INFO] loading stable diffusion...')
    
    if hf_key is not None:
        print(f'[INFO] using hugging face custom model key: {hf_key}')
        model_key = hf_key
    elif self.sd_version == '2.0':
        model_key = "stabilityai/stable-diffusion-2-base"
    elif self.sd_version == '1.5':
        model_key = "runwayml/stable-diffusion-v1-5"
    elif self.sd_version == '1.4':
        model_key = "CompVis/stable-diffusion-v1-4"
    else:
        raise ValueError(f'Stable-diffusion version {self.sd_version} not supported.')

    # Create model
    self.vae = AutoencoderKL.from_pretrained(model_key, subfolder="vae").to(self.device)
    self.tokenizer = CLIPTokenizer.from_pretrained(model_key, subfolder="tokenizer")
    self.text_encoder = CLIPTextModel.from_pretrained(model_key, subfolder="text_encoder").to(self.device)
    self.image_encoder = CLIPVisionModel.from_pretrained("openai/clip-vit-large-patch14").to(self.device)
    self.text_clip_encoder = CLIPVisionModel.from_pretrained("openai/clip-vit-large-patch14").to(self.device)
    
    self.processor = CLIPFeatureExtractor.from_pretrained("openai/clip-vit-large-patch14")
   

Hi , JaneWen,

I am not able to debug with just a definition of a class. Could you check the error log, provide a minimal code that is the core that gives that error.

With a easily reproduce the error that I can run the script directly , I can take a look.

@ydshieh Hi ydshieh, the error is as following.
Traceback (most recent call last):
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
conn.connect()
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connection.py", line 782, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/util/ssl
.py", line 470, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/util/ssl
.py", line 514, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/ssl.py", line 501, in wrap_socket
return self.sslsocket_class._create(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/ssl.py", line 1074, in _create
self.do_handshake()
File "/root/miniconda3/envs/makeit3d/lib/python3.9/ssl.py", line 1343, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/util/retry.py", line 470, in increment
raise reraise(type(error), error, _stacktrace)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/util/util.py", line 38, in reraise
raise value.with_traceback(tb)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
conn.connect()
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connection.py", line 642, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/connection.py", line 782, in ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/util/ssl
.py", line 470, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/urllib3/util/ssl
.py", line 514, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/ssl.py", line 501, in wrap_socket
return self.sslsocket_class._create(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/ssl.py", line 1074, in _create
self.do_handshake()
File "/root/miniconda3/envs/makeit3d/lib/python3.9/ssl.py", line 1343, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1247, in hf_hub_download
metadata = get_hf_file_metadata(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1624, in get_hf_file_metadata
r = _request_wrapper(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 402, in _request_wrapper
response = _request_wrapper(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 425, in _request_wrapper
response = get_session().request(method=method, url=url, **params)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/utils/_http.py", line 62, in send
return super().send(request, *args, **kwargs)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/requests/adapters.py", line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: 1d47162d-291e-48d5-906f-2327b6e8ce90)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/diffusers/configuration_utils.py", line 371, in load_config
config_file = hf_hub_download(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1377, in hf_hub_download
raise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/autodl-tmp/dreambooth-3d/main.py", line 171, in
guidance = StableDiffusion(device, opt.sd_version, opt.hf_key, step_range=opt.step_range)
File "/root/autodl-tmp/dreambooth-3d/nerf/sd.py", line 43, in init
self.vae = AutoencoderKL.from_pretrained(model_key, subfolder="vae").to(self.device)
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/diffusers/models/modeling_utils.py", line 712, in from_pretrained
config, unused_kwargs, commit_hash = cls.load_config(
File "/root/miniconda3/envs/makeit3d/lib/python3.9/site-packages/diffusers/configuration_utils.py", line 398, in load_config
raise EnvironmentError(
OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json.
Thanks for your time.

Hi, I have solved the issue. The problem is I didn't log in to the huggingface. I use the command huggingface-cli login and the pretrained model can be downloaded successfully.

Hi @JaneWen

Thank you for sharing the error log + I am glad you solved the issue already.

I will note this situation down, so Iwe can better help (other users) in the future.

Sign up or log in to comment