sd-webui-controlnet
sd-webui-controlnet copied to clipboard
Cannot load openpose model.
When I press the preview annotator result button, the model cannot load the pth file correctly.
venv "D:\yc\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Commit hash:
Launching Web UI with arguments: --xformers Loading weights [3a17d0deff] from D:\yc\stable-diffusion-webui\models\Stable-diffusion\chilloutmix_NiCkpt.ckpt Creating model from config: D:\yc\stable-diffusion-webui\configs\v1-inference.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Applying xformers cross attention optimization. Textual inversion embeddings loaded(2): awaitingtongue, Megumin_1000 Model loaded in 152.2s (load weights from disk: 121.4s, create model: 1.8s, apply weights to model: 2.6s, apply half(): 2.1s, load VAE: 0.2s, move model to device: 1.3s, hijack: 0.1s, load textual inversion embeddings: 22.6s). Running on local URL: http://127.0.0.1:7860
To create a public link, set share=True
in launch()
.
Traceback (most recent call last):
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
output = await app.get_blocks().process_api(
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
result = await self.call_function(
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "D:\yc\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 380, in run_annotator
result = preprocessor(img, res=pres, thr_a=pthr_a, thr_b=pthr_b)
File "D:\yc\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\processor.py", line 129, in openpose
result, _ = model_openpose(img, has_hand)
File "D:\yc\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\openpose_init_.py", line 45, in apply_openpose
body_estimation = Body(body_modelpath)
File "D:\yc\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\openpose\body.py", line 21, in init
model_dict = util.transfer(self.model, torch.load(model_path))
File "D:\yc\stable-diffusion-webui\modules\safe.py", line 106, in load
return load_with_extra(filename, extra_handler=global_extra_handler, *args, **kwargs)
File "D:\yc\stable-diffusion-webui\modules\safe.py", line 151, in load_with_extra
return unsafe_torch_load(filename, *args, **kwargs)
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 795, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 1020, in _legacy_load
typed_storage._storage._set_from_file(
RuntimeError: unexpected EOF, expected 803948 more bytes. The file might be corrupted.
But sha256 of the pth file is correct.
I get the same error, not sure what happened... openpose used to work great. Here's what I get now:
Loading model: control_sd15_openpose [fef5e48e] Loaded state_dict from [C:\Users\z\stable-diffusion-webui\extensions\sd-webui-controlnet\models\control_sd15_openpose.pth] ControlNet model control_sd15_openpose [fef5e48e] loaded. Loading preprocessor: openpose Error running process: C:\Users\z\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py Traceback (most recent call last): File "C:\Users\z\stable-diffusion-webui\modules\scripts.py", line 386, in process script.process(p, *script_args) File "C:\Users\z\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 655, in process detected_map = preprocessor(input_image, res=pres, thr_a=pthr_a, thr_b=pthr_b) File "C:\Users\z\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\processor.py", line 129, in openpose result, _ = model_openpose(img, has_hand) File "C:\Users\z\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\openpose\__init__.py", line 45, in apply_openpose body_estimation = Body(body_modelpath) File "C:\Users\z\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\openpose\body.py", line 21, in __init__ model_dict = util.transfer(self.model, torch.load(model_path)) File "C:\Users\z\stable-diffusion-webui\modules\safe.py", line 106, in load return load_with_extra(filename, extra_handler=global_extra_handler, *args, **kwargs) File "C:\Users\z\stable-diffusion-webui\modules\safe.py", line 151, in load_with_extra return unsafe_torch_load(filename, *args, **kwargs) File "C:\Users\z\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 795, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "C:\Users\z\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 1020, in _legacy_load typed_storage._storage._set_from_file( RuntimeError: unexpected EOF, expected 1406028 more bytes. The file might be corrupted.
Anyone have an idea on how I can fix this?
Edit: Tried the pruned version of the OpenPose file and I get the exact same error. I'm lost.
I update the extension and the error becomes as follows:
Traceback (most recent call last): File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function( File "D:\yc\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 795, in call_function assert block_fn.fn, f"function with index {fn_index} not defined." AssertionError: function with index 52 not defined.
Did you manage to solve this ? I've tried using openpose and I'm getting the same errors.
Did you manage to solve this ? I've tried using openpose and I'm getting the same errors.
I have just solved that problem. The error has nothing to do with the openpose.pth file because it is not loaded in the preprocessor script. It is caused by the corruption of body_pose_model.pth and hand_pose_model.pth. Maybe your files are corrupted too.
Great! That was actually it, the body_pose model was around 70mb smaller :) !
Thanks for reaching out
I had the same problem. The cause of the problem is that when downloading the model file when using ControlNet for the first time, the web-ui is closed and the file is not downloaded completely. When I delete all the files in stable-diffusion-webui\models\openpose\*.pth
and re-download them again, it can run normally.