Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue]: Control: loading single-file safetensors fails #3578

Open
2 tasks done
lbeltrame opened this issue Nov 19, 2024 · 2 comments
Open
2 tasks done

[Issue]: Control: loading single-file safetensors fails #3578

lbeltrame opened this issue Nov 19, 2024 · 2 comments
Labels
bug Something isn't working upstream Fix is required in upstream library

Comments

@lbeltrame
Copy link
Contributor

Issue Description

Notice: I have no idea if it's a problem with the model or with SD.Next. The error however is quite puzzling (see below).

Steps to reproduce

  1. Download https://civitai.com/models/962537/noobai-xl-controlnet-openpose?modelVersionId=1077649 to the Control model directory (not in a subfolder)
  2. Open Control
  3. Add a Control unit and select the newly-downloaded model

Expected result

Model loads.

Actual results

A rather strange traceback is reported (see log).

Version Platform Description

14:19:48-446602 INFO Starting SD.Next
14:19:48-449510 INFO Logger: file="/notebooks/automatic/sdnext.log"
level=INFO size=8682430 mode=append
14:19:48-450590 INFO Python: version=3.10.10 platform=Linux
bin="/usr/local/bin/python" venv="/usr"
14:19:48-451557 INFO Skipping GIT operations
14:19:48-498638 INFO Version: app=sd.next updated=2024-11-19 hash=31f219e3
branch=dev
url=https://github.com/vladmandic/automatic/tree/dev
ui=dev
14:19:48-503531 INFO Platform: arch=x86_64 cpu=x86_64 system=Linux
release=5.19.0-45-generic python=3.10.10 docker=False
14:19:48-505750 INFO Args: ['--disable-console-progressbars', '--uv',
14:19:56-294441 INFO Device: device=NVIDIA RTX A4000 n=1 arch=sm_90
capability=(8, 6) cuda=12.1 cudnn=90100
driver=525.116.04

Relevant log output

14:21:23-612458 ERROR    Control ControlNet model load failed:                  
                         id="noobaiXLControlnet_openposeModel"                  
                         error=stable-diffusion-v1-5/stable-diffusion-v1-5 does 
                         not appear to have a file named config.json.           
14:21:23-614117 ERROR    Control ControlNet load: OSError                       
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_http.py:406 i │
│                                                                              │
│   405 │   try:                                                               │
│ ❱ 406 │   │   response.raise_for_status()                                    │
│   407 │   except HTTPError as e:                                             │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/requests/models.py:1024 in raise_for │
│                                                                              │
│   1023 │   │   if http_error_msg:                                            │
│ ❱ 1024 │   │   │   raise HTTPError(http_error_msg, response=self)            │
│   1025                                                                       │
╰──────────────────────────────────────────────────────────────────────────────╯
HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/config.json

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

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py:379 │
│                                                                              │
│   378 │   │   │   │   # Load from URL or cache if already cached             │
│ ❱ 379 │   │   │   │   config_file = hf_hub_download(                         │
│   380 │   │   │   │   │   pretrained_model_name_or_path,                     │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py │
│                                                                              │
│   113 │   │                                                                  │
│ ❱ 114 │   │   return fn(*args, **kwargs)                                     │
│   115                                                                        │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:862 │
│                                                                              │
│    861 │   else:                                                             │
│ ❱  862 │   │   return _hf_hub_download_to_cache_dir(                         │
│    863 │   │   │   # Destination                                             │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:925 │
│                                                                              │
│    924 │   # If we can't, a HEAD request error is returned.                  │
│ ❱  925 │   (url_to_download, etag, commit_hash, expected_size, head_call_err │
│    926 │   │   repo_id=repo_id,                                              │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:137 │
│                                                                              │
│   1375 │   │   │   try:                                                      │
│ ❱ 1376 │   │   │   │   metadata = get_hf_file_metadata(                      │
│   1377 │   │   │   │   │   url=url, proxies=proxies, timeout=etag_timeout, h │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py │
│                                                                              │
│   113 │   │                                                                  │
│ ❱ 114 │   │   return fn(*args, **kwargs)                                     │
│   115                                                                        │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:129 │
│                                                                              │
│   1295 │   # Retrieve metadata                                               │
│ ❱ 1296 │   r = _request_wrapper(                                             │
│   1297 │   │   method="HEAD",                                                │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:277 │
│                                                                              │
│    276 │   if follow_relative_redirects:                                     │
│ ❱  277 │   │   response = _request_wrapper(                                  │
│    278 │   │   │   method=method,                                            │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:301 │
│                                                                              │
│    300 │   response = get_session().request(method=method, url=url, **params │
│ ❱  301 │   hf_raise_for_status(response)                                     │
│    302 │   return response                                                   │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_http.py:417 i │
│                                                                              │
│   416 │   │   │   message = f"{response.status_code} Client Error." + "\n\n" │
│ ❱ 417 │   │   │   raise _format(EntryNotFoundError, message, response) from  │
│   418                                                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
EntryNotFoundError: 404 Client Error. (Request ID: Root=1-673c9ee3-285736b5459934010be90b12;84ceaf3b-855f-4b9c-b328-598babdfe815)

Entry Not Found for url: https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/config.json.

During handling of the above exception, another exception occurred:

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /notebooks/automatic/modules/control/units/controlnet.py:226 in load         │
│                                                                              │
│   225 │   │   │   if model_path.endswith('.safetensors'):                    │
│ ❱ 226 │   │   │   │   self.load_safetensors(model_path)                      │
│   227 │   │   │   else:                                                      │
│                                                                              │
│ /notebooks/automatic/modules/control/units/controlnet.py:203 in load_safeten │
│                                                                              │
│   202 │   │   cls = self.get_class()                                         │
│ ❱ 203 │   │   self.model = cls.from_single_file(model_path, **self.load_conf │
│   204                                                                        │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py │
│                                                                              │
│   113 │   │                                                                  │
│ ❱ 114 │   │   return fn(*args, **kwargs)                                     │
│   115                                                                        │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/diffusers/loaders/single_file_model. │
│                                                                              │
│   267 │   │   │                                                              │
│ ❱ 268 │   │   │   diffusers_model_config = cls.load_config(                  │
│   269 │   │   │   │   pretrained_model_name_or_path=default_pretrained_model │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py │
│                                                                              │
│   113 │   │                                                                  │
│ ❱ 114 │   │   return fn(*args, **kwargs)                                     │
│   115                                                                        │
│                                                                              │
│ /usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py:406 │
│                                                                              │
│   405 │   │   │   except EntryNotFoundError:                                 │
│ ❱ 406 │   │   │   │   raise EnvironmentError(                                │
│   407 │   │   │   │   │   f"{pretrained_model_name_or_path} does not appear  │
╰──────────────────────────────────────────────────────────────────────────────╯
OSError: stable-diffusion-v1-5/stable-diffusion-v1-5 does not appear to have a file named config.json.

Backend

Diffusers

UI

ModernUI

Branch

Dev

Model

StableDiffusion XL

Acknowledgements

  • I have read the above and searched for existing issues
  • I confirm that this is classified correctly and its not an extension issue
@lbeltrame
Copy link
Contributor Author

Deleted the previous comment as it was misleading. I wonder if it's the actual model that it is broken?

@vladmandic
Copy link
Owner

upstream issue, created huggingface/diffusers#9976

@vladmandic vladmandic added upstream Fix is required in upstream library bug Something isn't working labels Nov 20, 2024
lbeltrame added a commit to lbeltrame/automatic that referenced this issue Nov 20, 2024
The upstream repository by Laxhar Labs does not provide a config.json.
Due to huggingface/diffusers#9976, the single-file safetensors provided
can't be loaded. As such, use a mirror which provides the model in
diffusers format (the model file is in that format already anyway).

Workarounds vladmandic#3578 for this specific model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Fix is required in upstream library
Projects
None yet
Development

No branches or pull requests

2 participants