Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: #2133 broke adetailer + controlnet #2200

Closed
1 task done
Bing-su opened this issue Oct 28, 2023 · 2 comments
Closed
1 task done

[Bug]: #2133 broke adetailer + controlnet #2200

Bing-su opened this issue Oct 28, 2023 · 2 comments

Comments

@Bing-su
Copy link

Bing-su commented Oct 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits of both this extension and the webui

What happened?

after e382d16 commit (#2133), controlnet is no longer available with adetailer.

Steps to reproduce the problem

use latest controlnet and adetailer

chrome_LuSkepGGO7

set controlnet model on adetailer tap

What should have happened?

external_code.py should work without any issues.

Commit where the problem happens

webui: 1.6.0
controlnet: e382d16

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

Launching Web UI with arguments: --xformers --api

List of enabled extensions

chrome_PkCast3hIc

Console logs

(sd)
adetailer on  dev via 🐍 v3.10.12 via 🅒 sd
❯ task launch
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:34:57) [MSC v.1936 64 bit (AMD64)]
Version: v1.6.0-106-g78213d4a
Commit hash: 78213d4a38872c046fecdc166875ef5f626577c4
Launching Web UI with arguments: --xformers --api
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 23.10.2.dev0, num models: 37
2023-10-28 19:13:07,174 - ControlNet - INFO - ControlNet v1.1.411
ControlNet preprocessor location: D:\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2023-10-28 19:13:07,396 - ControlNet - INFO - ControlNet v1.1.411
Loading weights [5998292c04] from D:\stable-diffusion-webui\models\Stable-diffusion\Counterfeit-V3.0_fp16-no-ema.safetensors
Creating model from config: D:\stable-diffusion-webui\configs\v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 14.6s (prepare environment: 2.3s, import torch: 3.4s, import gradio: 1.4s, setup paths: 0.6s, initialize shared: 0.2s, other imports: 0.6s, setup codeformer: 0.1s, load scripts: 4.4s, create ui: 0.7s, gradio launch: 0.7s).
Loading VAE weights specified in settings: D:\stable-diffusion-webui\models\VAE\kl-f8-anime2.safetensors
Applying attention optimization: xformers... done.
Model loaded in 8.0s (load weights from disk: 0.5s, create model: 1.0s, apply weights to model: 5.0s, load VAE: 0.6s, load textual inversion embeddings: 0.4s, calculate empty prompt: 0.3s).
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:06<00:00,  3.33it/s]
*** Error running postprocess_image: D:\stable-diffusion-webui\extensions\adetailer\scripts\!adetailer.py00,  4.29it/s]
    Traceback (most recent call last):
      File "D:\stable-diffusion-webui\modules\scripts.py", line 675, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "D:\stable-diffusion-webui\extensions\adetailer\adetailer\traceback.py", line 159, in wrapper
        raise error from None
    TypeError:
    ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │                                                   System info                                                    │
    │ ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃             ┃ Value                                                                                          ┃ │
    │ ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │
    │ │    Platform │ Windows-10-10.0.22621-SP0                                                                      │ │
    │ │      Python │ 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:34:57) [MSC v.1936 64 bit (AMD64)]  │ │
    │ │     Version │ v1.6.0-106-g78213d4a                                                                           │ │
    │ │      Commit │ 78213d4a38872c046fecdc166875ef5f626577c4                                                       │ │
    │ │ Commandline │ ['launch.py', '--xformers', '--api']                                                           │ │
    │ │   Libraries │ {'torch': '2.1.0+cu121', 'torchvision': '0.16.0+cu121', 'ultralytics': '8.0.202', 'mediapipe': │ │
    │ │             │ '0.10.7'}                                                                                      │ │
    │ └─────────────┴────────────────────────────────────────────────────────────────────────────────────────────────┘ │
    │                                                      Inputs                                                      │
    │ ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃                 ┃ Value                                                                                      ┃ │
    │ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │
    │ │          prompt │ masterpiece, best quality, 1girl, <lora:add_detail:0.5>                                    │ │
    │ │ negative_prompt │ (worst quality, low quality:1.1), text, title, logo, signature, (EasyNegativeV2:0.7),      │ │
    │ │                 │ (negative_hand-neg:0.7)                                                                    │ │
    │ │          n_iter │ 1                                                                                          │ │
    │ │      batch_size │ 2                                                                                          │ │
    │ │           width │ 512                                                                                        │ │
    │ │          height │ 768                                                                                        │ │
    │ │    sampler_name │ DPM++ 2M Karras                                                                            │ │
    │ │       enable_hr │ False                                                                                      │ │
    │ │     hr_upscaler │ Latent                                                                                     │ │
    │ │      checkpoint │ Counterfeit-V3.0_fp16-no-ema.safetensors [5998292c04]                                      │ │
    │ │             vae │ kl-f8-anime2.safetensors                                                                   │ │
    │ │            unet │ Automatic                                                                                  │ │
    │ └─────────────────┴────────────────────────────────────────────────────────────────────────────────────────────┘ │
    │                       ADetailer                                                                                  │
    │ ┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓                                                            │
    │ ┃                     ┃ Value                       ┃                                                            │
    │ ┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩                                                            │
    │ │             version │ 23.10.2.dev0                │                                                            │
    │ │            ad_model │ face_yolov8n.pt             │                                                            │
    │ │           ad_prompt │                             │                                                            │
    │ │  ad_negative_prompt │                             │                                                            │
    │ │ ad_controlnet_model │ control_v11p_sd15_openpose  │                                                            │
    │ │              is_api │ False                       │                                                            │
    │ └─────────────────────┴─────────────────────────────┘                                                            │
    │ ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮             │
    │ │ D:\stable-diffusion-webui\extensions\adetailer\adetailer\traceback.py:139 in wrapper             │             │
    │ │                                                                                                  │             │
    │ │   136 │   │   width = width - 4 if width > 4 else None                                           │             │
    │ │   137 │   │   console = Console(file=string, width=width)                                        │             │
    │ │   138 │   │   try:                                                                               │             │
    │ │ ❱ 139 │   │   │   return func(*args, **kwargs)                                                   │             │
    │ │   140 │   │   except Exception as e:                                                             │             │
    │ │   141 │   │   │   tables = [                                                                     │             │
    │ │   142 │   │   │   │   get_table(title, data)                                                     │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\adetailer\scripts\!adetailer.py:740 in postprocess_image    │             │
    │ │                                                                                                  │             │
    │ │   737 │   │   │   for n, args in enumerate(arg_list):                                            │             │
    │ │   738 │   │   │   │   if args.ad_model == "None":                                                │             │
    │ │   739 │   │   │   │   │   continue                                                               │             │
    │ │ ❱ 740 │   │   │   │   is_processed |= self._postprocess_image_inner(p, pp, args, n=n)            │             │
    │ │   741 │   │                                                                                      │             │
    │ │   742 │   │   if is_processed and not getattr(p, "_ad_skip_img2img", False):                     │             │
    │ │   743 │   │   │   self.save_image(                                                               │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\adetailer\scripts\!adetailer.py:650 in                      │             │
    │ │ _postprocess_image_inner                                                                         │             │
    │ │                                                                                                  │             │
    │ │   647 │   │   i = self.get_i(p)                                                                  │             │
    │ │   648 │   │                                                                                      │             │
    │ │   649 │   │   pp.image = self.get_i2i_init_image(p, pp)                                          │             │
    │ │ ❱ 650 │   │   i2i = self.get_i2i_p(p, args, pp.image)                                            │             │
    │ │   651 │   │   seed, subseed = self.get_seed(p)                                                   │             │
    │ │   652 │   │   ad_prompts, ad_negatives = self.get_prompt(p, args)                                │             │
    │ │   653                                                                                            │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\adetailer\scripts\!adetailer.py:519 in get_i2i_p            │             │
    │ │                                                                                                  │             │
    │ │   516 │   │   i2i._ad_inner = True                                                               │             │
    │ │   517 │   │                                                                                      │             │
    │ │   518 │   │   if args.ad_controlnet_model != "None":                                             │             │
    │ │ ❱ 519 │   │   │   self.update_controlnet_args(i2i, args)                                         │             │
    │ │   520 │   │   else:                                                                              │             │
    │ │   521 │   │   │   i2i.control_net_enabled = False                                                │             │
    │ │   522                                                                                            │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\adetailer\scripts\!adetailer.py:187 in                      │             │
    │ │ update_controlnet_args                                                                           │             │
    │ │                                                                                                  │             │
    │ │   184 │   │   │   and self.controlnet_ext.cn_available                                           │             │
    │ │   185 │   │   │   and args.ad_controlnet_model != "None"                                         │             │
    │ │   186 │   │   ):                                                                                 │             │
    │ │ ❱ 187 │   │   │   self.controlnet_ext.update_scripts_args(                                       │             │
    │ │   188 │   │   │   │   p,                                                                         │             │
    │ │   189 │   │   │   │   model=args.ad_controlnet_model,                                            │             │
    │ │   190 │   │   │   │   module=args.ad_controlnet_module,                                          │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\adetailer\controlnet_ext\controlnet_ext.py:93 in            │             │
    │ │ update_scripts_args                                                                              │             │
    │ │                                                                                                  │             │
    │ │    90 │   │   │   )                                                                              │             │
    │ │    91 │   │   ]                                                                                  │             │
    │ │    92 │   │                                                                                      │             │
    │ │ ❱  93 │   │   self.external_cn.update_cn_script_in_processing(p, cn_units)                       │             │
    │ │    94                                                                                            │             │
    │ │    95                                                                                            │             │
    │ │    96 def get_cn_model_dirs() -> list[Path]:                                                     │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py:34 │             │
    │ │ 1 in update_cn_script_in_processing                                                              │             │
    │ │                                                                                                  │             │
    │ │   338 │                                                                                          │             │
    │ │   339 │   cn_units_type = type(cn_units) if type(cn_units) in (list, tuple) else list            │             │
    │ │   340 │   script_args = p.script_args_value                                                      │             │
    │ │ ❱ 341 │   update_cn_script_in_place(p.scripts, script_args, cn_units)                            │             │
    │ │   342 │   p.script_args = cn_units_type(script_args)                                             │             │
    │ │   343                                                                                            │             │
    │ │   344                                                                                            │             │
    │ │                                                                                                  │             │
    │ │ D:\stable-diffusion-webui\extensions\sd-webui-controlnet\internal_controlnet\external_code.py:37 │             │
    │ │ 2 in update_cn_script_in_place                                                                   │             │
    │ │                                                                                                  │             │
    │ │   369 │   for script in script_runner.alwayson_scripts:                                          │             │
    │ │   370 │   │   if script is cn_script:                                                            │             │
    │ │   371 │   │   │   cn_script_args_diff = len(cn_units) - (cn_script.args_to - cn_script.args_fr   │             │
    │ │ ❱ 372 │   │   │   script_args[script.args_from:script.args_to] = cn_units                        │             │
    │ │   373 │   │   │   script.args_to = script.args_from + len(cn_units)                              │             │
    │ │   374 │   │   else:                                                                              │             │
    │ │   375 │   │   │   script.args_from += cn_script_args_diff                                        │             │
    │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯             │
    │ TypeError: 'tuple' object does not support item assignment                                                       │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Additional information

If the user's webui version is less than 1.6.0, AttributeError occurs:

AttributeError: 'StableDiffusionProcessingImg2Img' object has no attribute 'script_args_value'

Because the script_args_value attribute was added in webui version 1.6.0.

In webui 1.6.0, script_args_value's annotation is list, but the real type appears to be a tuple.

TypeError: 'tuple' object does not support item assignment    
@huchenlei
Copy link
Collaborator

Problem PR reverted. I will take a look at root cause later and make sure both Deforum and ADetailer are happy with the external_code.py setup. 🙃

@Bing-su
Copy link
Author

Bing-su commented Oct 29, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants