lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
5.31k stars 520 forks source link

[Bug]: controlnet error when flash install #709

Open bluelovers opened 2 months ago

bluelovers commented 2 months ago

Checklist

What happened?

2024-05-05 05:30:54,632 - ControlNet - INFO - ControlNet Input Mode: InputMode.SIMPLE
*** Error running process: D:\webui_forge_cu121_torch21\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
    Traceback (most recent call last):
      File "D:\webui_forge_cu121_torch21\webui\modules\scripts.py", line 803, in process
        script.process(p, *script_args)
      File "D:\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "D:\webui_forge_cu121_torch21\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 559, in process
        self.process_unit_after_click_generate(p, unit, params, *args, **kwargs)
      File "D:\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "D:\webui_forge_cu121_torch21\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 309, in process_unit_after_click_generate
        input_list, resize_mode = self.get_input_data(p, unit, preprocessor, h, w)
      File "D:\webui_forge_cu121_torch21\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 169, in get_input_data
        if unit.input_mode == InputMode.MERGE:
    NameError: name 'InputMode' is not defined

---
*** Error running process_before_every_sampling: D:\webui_forge_cu121_torch21\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
    Traceback (most recent call last):
      File "D:\webui_forge_cu121_torch21\webui\modules\scripts.py", line 835, in process_before_every_sampling
        script.process_before_every_sampling(p, *script_args, **kwargs)
      File "D:\webui_forge_cu121_torch21\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "D:\webui_forge_cu121_torch21\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 566, in process_before_every_sampling
        self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)
    KeyError: 0

Steps to reproduce the problem

  1. delete venv or use One-Click Package
  2. run webui
  3. use controlnet
  4. error with controlnet not work

What should have happened?

.

What browsers do you use to access the UI ?

No response

Sysinfo

sysinfo-2024-05-04-21-45.json

Console logs

.

Additional information

No response

gohan2091 commented 1 month ago

Same... I updated from the main branch to dev2 just now and now my ControlNet is completely broken. No feature of it works. Screenshot 2024-05-07 014900

PaulZ0 commented 1 month ago

Adding InputMode to the import at the top of the file fixes it for me

stable-diffusion-webui-forge/extensions-builtin/sd_forge_controlnet/scripts/controlnet.py Line 30: from lib_controlnet.enums import HiResFixOption, InputMode

bluelovers commented 1 month ago

my fix way is

install/run a1111 , and copy its venv to forge, then will work

gohan2091 commented 1 month ago

Adding InputMode to the import at the top of the file fixes it for me

stable-diffusion-webui-forge/extensions-builtin/sd_forge_controlnet/scripts/controlnet.py Line 30: from lib_controlnet.enums import HiResFixOption, InputMode

I don't find your instructions very clear but I did what I thought you meant. I've attached my controlnet.py file contents here: https://pastebin.com/uW2WHapj. Could you kindly check that I made the changes you suggested? because I still get the same error. My ControlNet on dev2 does not work at alll. Screenshot 2024-05-07 172651

PaulZ0 commented 1 month ago

This is how my file looks

stable-diffusion-webui-forge/extensions-builtin/sd_forge_controlnet/scripts/controlnet.py https://pastebin.com/5L4CLtqp

I modified line 30 to add InputMode to the import

from lib_controlnet.enums import HiResFixOption -> from lib_controlnet.enums import HiResFixOption, InputMode

gohan2091 commented 1 month ago

This is how my file looks

stable-diffusion-webui-forge/extensions-builtin/sd_forge_controlnet/scripts/controlnet.py https://pastebin.com/5L4CLtqp

I modified line 30 to add InputMode to the import

from lib_controlnet.enums import HiResFixOption -> from lib_controlnet.enums import HiResFixOption, InputMode

Both our line 30s are the same so I don't know why my Control Net is not working but yours is

PaulZ0 commented 1 month ago

This is how my file looks stable-diffusion-webui-forge/extensions-builtin/sd_forge_controlnet/scripts/controlnet.py https://pastebin.com/5L4CLtqp I modified line 30 to add InputMode to the import from lib_controlnet.enums import HiResFixOption -> from lib_controlnet.enums import HiResFixOption, InputMode

Both our line 30s are the same so I don't know why my Control Net is not working but yours is

In your file, line 2 doesn't match.

from typing import Dict, Optional, Tuple, List, Union, HiResFixOption, InputMode

should be

from typing import Dict, Optional, Tuple, List, Union

gohan2091 commented 1 month ago

This is how my file looks stable-diffusion-webui-forge/extensions-builtin/sd_forge_controlnet/scripts/controlnet.py https://pastebin.com/5L4CLtqp I modified line 30 to add InputMode to the import from lib_controlnet.enums import HiResFixOption -> from lib_controlnet.enums import HiResFixOption, InputMode

Both our line 30s are the same so I don't know why my Control Net is not working but yours is

In your file, line 2 doesn't match.

from typing import Dict, Optional, Tuple, List, Union, HiResFixOption, InputMode

should be

from typing import Dict, Optional, Tuple, List, Union

Yes I'm aware of that. I edited that based on what you said "Adding InputMode to the import at the top of the file fixes it for me" - that's why it wasn't clear because line 30 wouldn't be the top of the file. Anyway, I have tried again and now my ControlNet works BUT the multi-input tabs are not working and resulting in the same error. Can you confirm your Multi-input is working?