Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
16.97k stars 1.95k forks source link

[Bug]: #1581

Closed jimlin1668478052 closed 1 year ago

jimlin1668478052 commented 1 year ago

Is there an existing issue for this?

What happened?

Today I start to use RunPod Fast Stable Diffusion, and install controlnet and models in huggingface, When I try to use openpose, the error below is reported. Although images can be generated, they do not follow the poses of my input image to the control net. Error running process: /workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py Traceback (most recent call last): File "/workspace/sd/stable-diffusion-webui/modules/scripts.py", line 451, in process script.process(p, script_args) File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 684, in process model_net = Script.load_control_model(p, unet, unit.model, unit.low_vram) File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 268, in load_control_model model_net = Script.build_control_model(p, unet, model, lowvram) File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 296, in build_control_model state_dict = load_state_dict(model_path) File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/utils.py", line 20, in load_state_dict torch.load(ckpt_path, map_location=torch.device(location)) File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 107, in load return load_with_extra(filename, args, extra_handler=global_extra_handler, *kwargs) File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 152, in load_with_extra return unsafe_torch_load(filename, args, kwargs) File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, '<'.

Steps to reproduce the problem

  1. set up a runpod 1 x RTX A4000 pod
  2. run the template of RunPod Fast Stable Diffusion (set controlnet models as "none") in Jupyter Lab
  3. download the controlnet models openpose and https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_openpose.yaml from https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main with wget to /sd/stable-diffusion-webui/models/ControlNet
  4. click "connect to HTTP service" to come to the Gradio interface
  5. run a prompt with ControlNet on, input an image with a person

What should have happened?

There should be no error, the image should be with figures with similar movements as the input images of openpose

Commit where the problem happens

webui: version: v1.3.2  •  python: 3.10.10  •  torch: 2.0.0+cu117  •  xformers: N/A  •  gradio: 3.29.0  •  checkpoint: 5493a0ec49 controlnet: v1.1.219 99408b9f

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No

List of enabled extensions

Screenshot 2023-06-07 002239 Screenshot 2023-06-07 002254

Console logs

Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: /workspace/sd/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper/setting.json
Civitai Helper: No setting file, use default
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
2023-06-07 07:08:45,794 - ControlNet - INFO - ControlNet v1.1.219
ControlNet preprocessor location: /workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
2023-06-07 07:08:45,884 - ControlNet - INFO - ControlNet v1.1.219
Loading weights [4c86efd062] from /workspace/sd/stable-diffusion-webui/models/Stable-diffusion/SDv1-5.ckpt
*Deforum ControlNet support: enabled*
Running on local URL: https://3hodsge55h9pyh-3000.proxy.runpod.net
✔ Connected
Startup time: 8.8s (import torch: 1.9s, import gradio: 0.8s, import ldm: 0.3s, other imports: 1.8s, load scripts: 2.5s, create ui: 1.2s, gradio launch: 0.2s).
Creating model from config: /workspace/sd/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying optimization: sdp... done.
Textual inversion embeddings loaded(1): negative_hand-neg
Model loaded in 10.5s (load weights from disk: 3.3s, create model: 1.4s, apply weights to model: 2.6s, apply half(): 2.8s, move model to device: 0.4s).
2023-06-07 07:10:45,122 - ControlNet - INFO - Loading model: control_v11p_sd15_openpose [e3b0c442]
Error running process: /workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py
Traceback (most recent call last):
  File "/workspace/sd/stable-diffusion-webui/modules/scripts.py", line 451, in process
    script.process(p, *script_args)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 684, in process
    model_net = Script.load_control_model(p, unet, unit.model, unit.low_vram)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 268, in load_control_model
    model_net = Script.build_control_model(p, unet, model, lowvram)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 296, in build_control_model
    state_dict = load_state_dict(model_path)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/utils.py", line 20, in load_state_dict
    torch.load(ckpt_path, map_location=torch.device(location))
  File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 107, in load
    return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
  File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 152, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1033, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

Found LyCORIS models, Using Composable LyCORIS.
Composable LoRA load successful.
100%|███████████████████████████████████████████| 35/35 [00:46<00:00,  1.34s/it]
Loading weights [5493a0ec49] from /workspace/sd/stable-diffusion-webui/models/Stable-diffusion/AOM3.safetensors
Applying optimization: sdp... done.
Weights loaded in 3.9s (load weights from disk: 0.2s, apply weights to model: 3.2s, move model to device: 0.4s).
2023-06-07 07:16:48,064 - ControlNet - INFO - Loading model: control_v11p_sd15_openpose [e3b0c442]
Error running process: /workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py
Traceback (most recent call last):
  File "/workspace/sd/stable-diffusion-webui/modules/scripts.py", line 451, in process
    script.process(p, *script_args)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 684, in process
    model_net = Script.load_control_model(p, unet, unit.model, unit.low_vram)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 268, in load_control_model
    model_net = Script.build_control_model(p, unet, model, lowvram)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 296, in build_control_model
    state_dict = load_state_dict(model_path)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/utils.py", line 20, in load_state_dict
    torch.load(ckpt_path, map_location=torch.device(location))
  File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 107, in load
    return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
  File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 152, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1033, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

100%|███████████████████████████████████████████| 35/35 [00:10<00:00,  3.34it/s]
2023-06-07 07:17:27,259 - ControlNet - INFO - Loading model: control_v11p_sd15_openpose [e3b0c442]
Error running process: /workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py
Traceback (most recent call last):
  File "/workspace/sd/stable-diffusion-webui/modules/scripts.py", line 451, in process
    script.process(p, *script_args)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 684, in process
    model_net = Script.load_control_model(p, unet, unit.model, unit.low_vram)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 268, in load_control_model
    model_net = Script.build_control_model(p, unet, model, lowvram)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 296, in build_control_model
    state_dict = load_state_dict(model_path)
  File "/workspace/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/utils.py", line 20, in load_state_dict
    torch.load(ckpt_path, map_location=torch.device(location))
  File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 107, in load
    return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
  File "/workspace/sd/stable-diffusion-webui/modules/safe.py", line 152, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/lib/python3.10/dist-packages/torch/serialization.py", line 1033, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

100%|███████████████████████████████████████████| 35/35 [00:09<00:00,  3.52it/s]

Additional information

No response

lllyasviel commented 1 year ago

make sure that you download https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose.pth not https://huggingface.co/lllyasviel/ControlNet-v1-1/blob/main/control_v11p_sd15_openpose.pth

Feel free to reopen if not solved

camilovietnam commented 1 year ago

Can confirm that I also had downloaded the 140 KB file, instead of the actual ControlNet model which is around 1GB in size. Downloading the actual model fixed the issue