Mikubill / sd-webui-controlnet

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

"Error running process controlnet.py" #108

Closed isketch93 closed 1 year ago

isketch93 commented 1 year ago

Hi! I just installed the extension following the steps on the readme page, downloaded the pre-extracted models (but the same issue appeared with full models upon trying) and excitedly tried to generate a couple of images, only to see the console spit out the following:

Loading preprocessor: canny, model: control_canny-fp16 [e3fe7712] Error running process: C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py Traceback (most recent call last): File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\modules\scripts.py", line 386, in process script.process(p, *script_args) File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 337, in process network = PlugableControlModel( File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\cldm.py", line 58, in init config = OmegaConf.load(config_path) File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\omegaconf\omegaconf.py", line 188, in load obj = yaml.load(f, Loader=get_yaml_loader()) File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml__init__.py", line 81, in load return loader.get_single_data() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\constructor.py", line 49, in get_single_data node = self.get_single_node() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\composer.py", line 36, in get_single_node document = self.compose_document() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\composer.py", line 58, in compose_document self.get_event() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\parser.py", line 118, in get_event self.current_event = self.state() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\parser.py", line 193, in parse_document_end token = self.peek_token() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\scanner.py", line 129, in peek_token self.fetch_more_tokens() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\scanner.py", line 223, in fetch_more_tokens return self.fetch_value() File "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\venv\lib\site-packages\yaml\scanner.py", line 577, in fetch_value raise ScannerError(None, None, yaml.scanner.ScannerError: mapping values are not allowed here in "C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui\extensions\sd-webui-controlnet\models\cldm_v15.yaml", line 27, column 66

After this, it goes on generating a normal img2img, without any effect from the extension. I tried swapping the cldm_v125.yaml file installed by the webui with the one found among the pre-extracted models, but it made no difference. Do you have any idea what might be causing this?

JokerWuXin commented 1 year ago

I have the same problem...help

Mikubill commented 1 year ago

Could you share your env details? pip list is enough.

JokerWuXin commented 1 year ago

Package Version


aiofiles 23.1.0 aiohttp 3.8.4 aiosignal 1.3.1 altair 4.2.2 anyio 3.6.2 async-timeout 4.0.2 attrs 22.2.0 certifi 2022.12.7 charset-normalizer 3.0.1 click 8.1.3 colorama 0.4.6 contourpy 1.0.7 cycler 0.11.0 entrypoints 0.4 fastapi 0.92.0 ffmpy 0.3.0 fonttools 4.38.0 frozenlist 1.3.3 fsspec 2023.1.0 gradio 3.16.2 h11 0.14.0 httpcore 0.16.3 httpx 0.23.3 idna 3.4 Jinja2 3.1.2 jsonschema 4.17.3 kiwisolver 1.4.4 linkify-it-py 1.0.3 markdown-it-py 2.1.0 MarkupSafe 2.1.2 matplotlib 3.7.0 mdit-py-plugins 0.3.3 mdurl 0.1.2 multidict 6.0.4 mypy-extensions 1.0.0 numpy 1.24.2 opencv-python 4.7.0.68 orjson 3.8.6 packaging 23.0 pandas 1.5.3 Pillow 9.4.0 pip 22.2.1 prettytable 3.6.0 pycryptodome 3.17 pydantic 1.10.5 pydub 0.25.1 pyparsing 3.0.9 pyre-extensions 0.0.23 pyrsistent 0.19.3 python-dateutil 2.8.2 python-multipart 0.0.5 pytz 2022.7.1 PyYAML 6.0 requests 2.28.2 rfc3986 1.5.0 setuptools 63.2.0 six 1.16.0 sniffio 1.3.0 starlette 0.25.0 toolz 0.12.0 typing_extensions 4.5.0 typing-inspect 0.8.0 uc-micro-py 1.0.1 urllib3 1.26.14 uvicorn 0.20.0 wcwidth 0.2.6 websockets 10.4 yarl 1.8.2

Mikubill commented 1 year ago

Have you activated your venv? Omegaconf not found in the list try:

source venv/bin/activate
pip list
JokerWuXin commented 1 year ago

Package Version


aiofiles 23.1.0 aiohttp 3.8.4 aiosignal 1.3.1 altair 4.2.2 antlr4-python3-runtime 4.9.3 anyio 3.6.2 async-timeout 4.0.2 attrs 22.2.0 certifi 2022.12.7 charset-normalizer 3.0.1 click 8.1.3 colorama 0.4.6 contourpy 1.0.7 cycler 0.11.0 distlib 0.3.6 entrypoints 0.4 fastapi 0.92.0 ffmpy 0.3.0 filelock 3.9.0 fonttools 4.38.0 frozenlist 1.3.3 fsspec 2023.1.0 gradio 3.16.2 h11 0.14.0 httpcore 0.16.3 httpx 0.23.3 idna 3.4 Jinja2 3.1.2 jsonschema 4.17.3 kiwisolver 1.4.4 linkify-it-py 1.0.3 markdown-it-py 2.1.0 MarkupSafe 2.1.2 matplotlib 3.7.0 mdit-py-plugins 0.3.3 mdurl 0.1.2 multidict 6.0.4 mypy-extensions 1.0.0 numpy 1.24.2 omegaconf 2.3.0 opencv-python 4.7.0.68 orjson 3.8.6 packaging 23.0 pandas 1.5.3 Pillow 9.4.0 pip 22.2.1 platformdirs 3.0.0 prettytable 3.6.0 pycryptodome 3.17 pydantic 1.10.5 pydub 0.25.1 pyparsing 3.0.9 pyre-extensions 0.0.23 pyrsistent 0.19.3 python-dateutil 2.8.2 python-multipart 0.0.5 pytz 2022.7.1 PyYAML 6.0 requests 2.28.2 rfc3986 1.5.0 setuptools 63.2.0 six 1.16.0 sniffio 1.3.0 starlette 0.25.0 toolz 0.12.0 typing_extensions 4.5.0 typing-inspect 0.8.0 uc-micro-py 1.0.1 urllib3 1.26.14 uvicorn 0.20.0 virtualenv 20.19.0 wcwidth 0.2.6 websockets 10.4 yarl 1.8.2

I have installed Omegaconf & virtualenv. What should I do next?

thanks~

Mikubill commented 1 year ago

Then try run this in Python

from omegaconf import OmegaConf
OmegaConf.load("<your-path>")
JokerWuXin commented 1 year ago

in Python

from omegaconf import OmegaConf config = OmegaConf.load("/Users/Joker/Downloads/stable-diffusion-webui-master/stable-diffusion-webui-master/extensions/sd-webui-controlnet/models/cldm_v15.yaml")

=================== RESTART: C:/Users/Joker/Downloads/0217.py ==================

it's nothing... @@?!

Mikubill commented 1 year ago

Nothing means omegaconf and yaml is correct. Then goto webui folder and activate venv, make sure omegaconf is in correct version, startup webui and test

JokerWuXin commented 1 year ago

venv "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\Scripts\Python.exe" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Commit hash: Installing requirements for Web UI Installing requirement for sd-webui-controlnet

Launching Web UI with arguments: No module 'xformers'. Proceeding without it. Loading weights [fe4efff1e1] from C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\models\Stable-diffusion\sd-v1-4.ckpt Creating model from config: C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\configs\v1-inference.yaml LatentDiffusion: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. Applying cross attention optimization (Doggettx). Textual inversion embeddings loaded(0): Model loaded in 40.6s (load weights from disk: 35.7s, create model: 1.2s, apply weights to model: 0.9s, apply half(): 0.8s, move model to device: 0.7s, load textual inversion embeddings: 1.3s). Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Loading preprocessor: openpose, model: control_sd15_openpose [fef5e48e] Loaded state_dict from [C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\extensions\sd-webui-controlnet\models\control_sd15_openpose.pth] Error running process: C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\controlnet.py Traceback (most recent call last): File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\modules\scripts.py", line 386, in process script.process(p, *script_args) File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\controlnet.py", line 343, in process network = PlugableControlModel( File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\cldm.py", line 112, in init self.control_model.to(devices.get_device_for("controlnet")) File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 989, in to return self._apply(convert) File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 641, in _apply module._apply(fn) File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 641, in _apply module._apply(fn) File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 641, in _apply module._apply(fn) [Previous line repeated 6 more times] File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 664, in _apply param_applied = fn(param) File "C:\Users\Joker\Downloads\stable-diffusion-webui-master\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 987, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)

T__________T
JokerWuXin commented 1 year ago

My installation steps can be found at https://vocus.cc/article/63eee139fd8978000188d7d8 Could you please check to see if I made any mistakes? Thanks~

isketch93 commented 1 year ago

When I run pip list this is all I get:

C:\Users\menar\OneDrive\Desktop\SUPER_Stable_Diffusion\stable-diffusion-webui>pip list Package Version numpy 1.24.2 opencv-python 4.7.0.68 pip 22.2.2 safetensors 0.2.8 setuptools 63.2.0 torch 1.13.1 typing_extensions 4.5.0

As I apparently miss that omegaconf from this list too, I tried running source venv/bin/activate, but it does not recognize source as a valid command. Note that I'm on windows, running every command from a cmd prompt launched from the webui main folder. Also, I'm not very python-savvy, so apologies if I missed something obvious.

JokerWuXin commented 1 year ago

You can find the installation method for venv here. https://linuxhint.com/activate-virtualenv-windows/ or pip install virtualenv pip install omegaconf

However, I am still experiencing issues even after installation, so I am attempting to reinstall and see if that resolves the problem.

isketch93 commented 1 year ago

pip install virtualenv pip install omegaconf

However, I am still experiencing issues even after installation [...]

I've done these two steps, both succeded, I still get the same error too. I guess by "I am attempting to reinstall" you mean the extension only, not all of the webui, right? I may try that aswell, as I can't seem to have any luck so far.

isketch93 commented 1 year ago

I can confirm that reinstalling the extension from scratch worked for me. The only thing I did differently from my first try was to install it from the "Available" tab inside the webui, instead of "Install from URL". Either that, or installing it after virtualenv and omegaconf, no idea on that regard.

zjc9999 commented 1 year ago

I'm having the same problem. Anyone know how to solve it? Thanks!

Bhagathxoxo commented 1 year ago

I'm getting the same problem. even after I reinstall everything from scratch.

Bhagathxoxo commented 1 year ago

I found the solution at https://github.com/Mikubill/sd-webui-controlnet/issues/446#issuecomment-1451194869

ivever2 commented 1 year ago

I finally found the problem, it was because (controlnet) and (segment-anything) conflicted, after closing (segment-anything), everything worked fine.

Anas-jaffery-kodexolab commented 5 months ago

I finally found the problem, it was because (controlnet) and (segment-anything) conflicted, after closing (segment-anything), everything worked fine.

Can you please tell me how to do that ,as first I am running segment anything and after the mask is created I am running controlnet