Mikubill / sd-webui-controlnet

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

[Bug]: Controlnet not loading with most recent WebUI #2967

Closed keenerb closed 4 months ago

keenerb commented 5 months ago

Is there an existing issue for this?

What happened?

Controlnet reports errors and does not load

Steps to reproduce the problem

Install Stable Diffusion A1111 WebUI Install Controlnet through Extensions tab Run webui.bat

What should have happened?

No errors and Controlnet options should appear in WebUI

Commit where the problem happens

webui: 1.9.4 controlnet: [8bbbd0e5]

What browsers do you use to access the UI ?

Google Chrome, Microsoft Edge

Command Line Arguments

None

List of enabled extensions

None

Console logs

z:\stable-diffusion-webui-new\stable-diffusion-webui>webui.bat
venv "z:\stable-diffusion-webui\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)]
Version: v1.9.4
Commit hash: feee37d75f1b168768014e4634dcb156ee649c05
Launching Web UI with arguments:
bin z:\stable-diffusion-webui\venv\lib\site-packages\bitsandbytes\libbitsandbytes_cuda121.dll
2024-06-28 11:09:51.766635: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
WARNING:tensorflow:From z:\stable-diffusion-webui\venv\lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

No module 'xformers'. Proceeding without it.
*** Error loading script: api.py
    Traceback (most recent call last):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\api.py", line 17, in <module>
        from scripts import external_code, global_state
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\external_code.py", line 1, in <module>
        from internal_controlnet.external_code import *  # noqa: F403
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py", line 7, in <module>
        from .args import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 52, in <module>
        class ControlNetUnit(BaseModel):
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\main.py", line 282, in __new__
        annotations = resolve_annotations(namespace.get('__annotations__', {}), namespace.get('__module__', None))
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\typing.py", line 287, in resolve_annotations
        value = _eval_type(value, base_globals, None)
      File "C:\Users\kb\AppData\Local\Programs\Python\Python310\lib\typing.py", line 327, in _eval_type
        return t._evaluate(globalns, localns, recursive_guard)
      File "C:\Users\kb\AppData\Local\Programs\Python\Python310\lib\typing.py", line 693, in _evaluate
        type_ = _type_check(
      File "C:\Users\kb\AppData\Local\Programs\Python\Python310\lib\typing.py", line 167, in _type_check
        raise TypeError(f"{arg} is not valid as type argument")
    TypeError: typing.ClassVar[typing.Callable[[str], bool]] is not valid as type argument

---
*** Error loading script: batch_hijack.py
    Traceback (most recent call last):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 5, in <module>
        from scripts import external_code
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\external_code.py", line 1, in <module>
        from internal_controlnet.external_code import *  # noqa: F403
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py", line 7, in <module>
        from .args import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 52, in <module>
        class ControlNetUnit(BaseModel):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 80, in ControlNetUnit
        def check_module(cls, value: str) -> str:
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 85, in dec
        f_cls = _prepare_validator(f, allow_reuse)
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 144, in _prepare_validator
        raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')
    pydantic.errors.ConfigError: duplicate validator function "internal_controlnet.args.ControlNetUnit.check_module"; if this is intended, set `allow_reuse=True`

---
ControlNet preprocessor location: Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
*** Error loading script: controlnet.py
    Traceback (most recent call last):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 18, in <module>
        from internal_controlnet.external_code import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py", line 7, in <module>
        from .args import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 52, in <module>
        class ControlNetUnit(BaseModel):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 80, in ControlNetUnit
        def check_module(cls, value: str) -> str:
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 85, in dec
        f_cls = _prepare_validator(f, allow_reuse)
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 144, in _prepare_validator
        raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')
    pydantic.errors.ConfigError: duplicate validator function "internal_controlnet.args.ControlNetUnit.check_module"; if this is intended, set `allow_reuse=True`

---
*** Error loading script: external_code.py
    Traceback (most recent call last):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\external_code.py", line 1, in <module>
        from internal_controlnet.external_code import *  # noqa: F403
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py", line 7, in <module>
        from .args import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 52, in <module>
        class ControlNetUnit(BaseModel):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 80, in ControlNetUnit
        def check_module(cls, value: str) -> str:
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 85, in dec
        f_cls = _prepare_validator(f, allow_reuse)
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 144, in _prepare_validator
        raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')
    pydantic.errors.ConfigError: duplicate validator function "internal_controlnet.args.ControlNetUnit.check_module"; if this is intended, set `allow_reuse=True`

---
*** Error loading script: infotext.py
    Traceback (most recent call last):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\infotext.py", line 7, in <module>
        from internal_controlnet.external_code import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py", line 7, in <module>
        from .args import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 52, in <module>
        class ControlNetUnit(BaseModel):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 80, in ControlNetUnit
        def check_module(cls, value: str) -> str:
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 85, in dec
        f_cls = _prepare_validator(f, allow_reuse)
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 144, in _prepare_validator
        raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')
    pydantic.errors.ConfigError: duplicate validator function "internal_controlnet.args.ControlNetUnit.check_module"; if this is intended, set `allow_reuse=True`

---
*** Error loading script: xyz_grid_support.py
    Traceback (most recent call last):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\scripts.py", line 508, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\modules\script_loading.py", line 13, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\xyz_grid_support.py", line 8, in <module>
        from scripts.external_code import ResizeMode, ControlMode
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\external_code.py", line 1, in <module>
        from internal_controlnet.external_code import *  # noqa: F403
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py", line 7, in <module>
        from .args import ControlNetUnit
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 52, in <module>
        class ControlNetUnit(BaseModel):
      File "Z:\stable-diffusion-webui-new\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\args.py", line 80, in ControlNetUnit
        def check_module(cls, value: str) -> str:
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 85, in dec
        f_cls = _prepare_validator(f, allow_reuse)
      File "z:\stable-diffusion-webui\venv\lib\site-packages\pydantic\class_validators.py", line 144, in _prepare_validator
        raise ConfigError(f'duplicate validator function "{ref}"; if this is intended, set `allow_reuse=True`')
    pydantic.errors.ConfigError: duplicate validator function "internal_controlnet.args.ControlNetUnit.check_module"; if this is intended, set `allow_reuse=True`

---
Loading weights [6ce0161689] from Z:\stable-diffusion-webui-new\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
Running on local URL:  http://127.0.0.1:7860
Creating model from config: Z:\stable-diffusion-webui-new\stable-diffusion-webui\configs\v1-inference.yaml

To create a public link, set `share=True` in `launch()`.
Startup time: 15.5s (prepare environment: 2.2s, import torch: 9.0s, import gradio: 0.7s, setup paths: 0.7s, initialize shared: 0.1s, other imports: 0.4s, load scripts: 1.4s, create ui: 0.3s, gradio launch: 0.6s).
Applying attention optimization: Doggettx... done.
Model loaded in 3.4s (load weights from disk: 0.4s, load config: 0.3s, create model: 0.3s, apply weights to model: 2.1s, calculate empty prompt: 0.1s).

Additional information

No response

huchenlei commented 5 months ago

What is your pydantic version?

keenerb commented 5 months ago

Successfully installed annotated-types-0.7.0 pydantic-2.7.4 pydantic-core-2.18.4 typing-extensions-4.12.2

On Fri, Jun 28, 2024 at 3:30 PM Chenlei Hu @.***> wrote:

What is your pydantic version?

— Reply to this email directly, view it on GitHub https://github.com/Mikubill/sd-webui-controlnet/issues/2967#issuecomment-2197506961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJA7N4NXV3U3SMTYLW5Y5LZJW2TZAVCNFSM6AAAAABKCKZH6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGUYDMOJWGE . You are receiving this because you authored the thread.Message ID: @.***>

huchenlei commented 5 months ago

Hmmmm. Did A1111 upgraded pydantic recently? The ControlNet code depends on pydantic 1.x.

huchenlei commented 5 months ago

Previously there was a fix on pydantic version here from A1111 core dev: https://github.com/Mikubill/sd-webui-controlnet/pull/2761

I am not sure if you installed any extension that requires pydantic 2.0+

keenerb commented 5 months ago

OK that gives me something to look at. I will investigate.

On Fri, Jun 28, 2024 at 5:01 PM Chenlei Hu @.***> wrote:

Previously there was a fix on pydantic version here from A1111 core dev:

2761 https://github.com/Mikubill/sd-webui-controlnet/pull/2761

I am not sure if you installed any extension that requires pydantic 2.0+

— Reply to this email directly, view it on GitHub https://github.com/Mikubill/sd-webui-controlnet/issues/2967#issuecomment-2197653774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJA7NZUS3WFMDRDBYBDQHLZJXFJTAVCNFSM6AAAAABKCKZH6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGY2TGNZXGQ . You are receiving this because you authored the thread.Message ID: @.***>

TjitseDeVries commented 4 months ago

Same issue

Upon installation, the Control-Net icon does not appear under dice icon.

Terminal gives following error.

** Error loading script: external_code.py Traceback (most recent call last): File "/[...]stable-diffusion-webui/modules/scripts.py", line 508, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "[...]/stable-diffusion-webui/modules/script_loading.py", line 13, in load_module module_spec.loader.exec_module(module) File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/[...]stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/external_code.py", line 1, in from internal_controlnet.external_code import # noqa: F403 File "/[...]/stable-diffusion-webui/extensions/sd-webui-controlnet/internal_controlnet/external_code.py", line 7, in from .args import ControlNetUnit File "/[...]/stable-diffusion-webui/extensions/sd-webui-controlnet/internal_controlnet/args.py", line 52, in class ControlNetUnit(BaseModel): File "/[...]stable-diffusion-webui/extensions/sd-webui-controlnet/internal_controlnet/args.py", line 80, in ControlNetUnit def check_module(cls, value: str) -> str: File "pydantic/class_validators.py", line 93, in pydantic.class_validators.validator.dec File "pydantic/class_validators.py", line 156, in pydantic.class_validators._prepare_validator pydantic.errors.ConfigError: duplicate validator function "internal_controlnet.args.ControlNetUnit.check_module"; if this is intended, set allow_reuse=True