Mikubill / sd-webui-controlnet

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

[Bug]: AttributeError: 'NoneType' object has no attribute '_id' #2136

Closed iurysouzatx closed 10 months ago

iurysouzatx commented 11 months ago

Is there an existing issue for this?

What happened?

Can't even launch the WebUI when ControlNet is installed. I updated the ControlNet and that's it.

Steps to reproduce the problem

Just open the WebUI

What should have happened?

The WebUI started normally.

Commit where the problem happens

webui: 5ef669de080814067961f28357256e8fe27544f4 controlnet: e67e017

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--xformers

List of enabled extensions

Pixel Art

Console logs

*** Error calling: E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet.py/ui
    Traceback (most recent call last):
      File "E:\AI\SD\webui\modules\scripts.py", line 402, in wrap_call
        return func(*args, **kwargs)
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 288, in ui
        group, state = self.uigroup(f"ControlNet-{i}", is_img2img, elem_id_tabname)
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 268, in uigroup
        group.register_callbacks(is_img2img)
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet_ui\controlnet_ui_group.py", line 820, in register_callbacks
        self.preset_panel.register_callbacks(
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet_ui\preset.py", line 172, in register_callbacks
        getattr(element, action)(
      File "E:\AI\SD\system\python\lib\site-packages\gradio\events.py", line 140, in __call__
        dep, dep_index = self.trigger.set_event_trigger(
      File "E:\AI\SD\system\python\lib\site-packages\gradio\blocks.py", line 286, in set_event_trigger
        "inputs": [block._id for block in inputs],
      File "E:\AI\SD\system\python\lib\site-packages\gradio\blocks.py", line 286, in <listcomp>
        "inputs": [block._id for block in inputs],
    AttributeError: 'NoneType' object has no attribute '_id'

---
*** Error calling: E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet.py/ui
    Traceback (most recent call last):
      File "E:\AI\SD\webui\modules\scripts.py", line 402, in wrap_call
        return func(*args, **kwargs)
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 288, in ui
        group, state = self.uigroup(f"ControlNet-{i}", is_img2img, elem_id_tabname)
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 268, in uigroup
        group.register_callbacks(is_img2img)
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet_ui\controlnet_ui_group.py", line 820, in register_callbacks
        self.preset_panel.register_callbacks(
      File "E:\AI\SD\webui\extensions\sd-webui-controlnet\scripts\controlnet_ui\preset.py", line 172, in register_callbacks
        getattr(element, action)(
      File "E:\AI\SD\system\python\lib\site-packages\gradio\events.py", line 140, in __call__
        dep, dep_index = self.trigger.set_event_trigger(
      File "E:\AI\SD\system\python\lib\site-packages\gradio\blocks.py", line 286, in set_event_trigger
        "inputs": [block._id for block in inputs],
      File "E:\AI\SD\system\python\lib\site-packages\gradio\blocks.py", line 286, in <listcomp>
        "inputs": [block._id for block in inputs],
    AttributeError: 'NoneType' object has no attribute '_id'

---

Additional information

No response

Guillaume-Fgt commented 11 months ago

in your stable-diffusion-webui\extensions\sd-webui-controlnet folder, do you have a presets folder? Is it empty? If not, try to delete this folder and reload the webui.

iurysouzatx commented 11 months ago

in your stable-diffusion-webui\extensions\sd-webui-controlnet folder, do you have a presets folder? Is it empty? If not, try to delete this folder and reload the webui.

Nothing on presets folder because I removed controlnet and tried to reinstall again, same problem.

PeterTF656 commented 11 months ago

same issue here

iurysouzatx commented 11 months ago

I don't know what caused this, but a new fresh install of SD got it to work again :/

PeterTF656 commented 11 months ago

I don't know what caused this, but a new fresh install of SD got it to work again :/

I tried a lot of fixes, but none worked. Finally I had to reinstall as well. Took me half a day... But I can make my waifus again now, so overall not bad...

Munichschntz commented 11 months ago

Delete your ui-config.json and config.json files.

AUTO1111 will complain the files don't exist on starting the server; don't worry, it's just a warning. You can recreate them by going to Settingsand clicking "Apply settings"

Hopefully this saves others from having to completely rebuild their install.

CurtisDS commented 10 months ago

For me it was the "txt2img/img2img UI item order" setting (Settings > User Interface). If you have changed it at all this extension throws all those errors on start up. Very annoying as I like having Scripts at the top of my UI.

CurtisDS commented 10 months ago

@huchenlei This issue is still happening on the latest commit if I alter the order of the UI. You marked this as closed, Was it supposed to have been fixed?

huchenlei commented 10 months ago

Please follow instructions in this comment: https://github.com/Mikubill/sd-webui-controlnet/issues/2136#issuecomment-1741850364

CurtisDS commented 10 months ago

That doesn't fix the issue. See https://github.com/Mikubill/sd-webui-controlnet/issues/2136#issuecomment-1789932744 As soon as I change the UI order back to the way I like it (using the built in setting of Automatic1111) the error occurs again.

It appears that Control Net is assuming the UI will have a specific structure but because the order of the UI was changed it leads to the gradio error. I don't mean to be pushy but this is a repeatable and narrow issue with the extension where it does not support a built in setting of Automatic1111 so I think this issue is deserving of a proper fix.

YuLinkun commented 4 months ago

I print the list inputs, and found one of the list is empty, so I repair it by change [block._id for block in inputs] to [block._id for block in inputs if block is not None]. It works for me.