Mikubill / sd-webui-controlnet

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

[Bug]: AttributeError: 'ControlNet' object has no attribute 'label_emb' #2155

Closed ilteris closed 11 months ago

ilteris commented 11 months ago

Is there an existing issue for this?

What happened?

I tried to use canny based on this tutorial: https://www.youtube.com/watch?v=6ZT2rxNl_lQ&t=59s

Steps to reproduce the problem

  1. Go to control net and add an image
  2. Press .generate after two seconds I get an error

What should have happened?

It should have generated the image

Commit where the problem happens

webui: 1.6.0 controlnet: 1.1.410

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

nope

List of enabled extensions

controlnet

Console logs

INFO:modules.shared_state:Starting job task(ydfnaskq5rnk6uj)
Starting job task(ydfnaskq5rnk6uj)
2023-10-03 10:50:47,455 - ControlNet - INFO - Loading model from cache: controlnetPreTrained_cannyV10 [e3fe7712]
2023-10-03 10:50:47,469 - ControlNet - INFO - Loading preprocessor: canny
2023-10-03 10:50:47,469 - ControlNet - INFO - preprocessor resolution = 512
2023-10-03 10:50:47,537 - ControlNet - INFO - ControlNet Hooked - Time = 0.08235812187194824
  0%|                                                                                                               | 0/19 [00:00<?, ?it/s]
*** Error completing request
*** Arguments: ('task(ydfnaskq5rnk6uj)', 0, 'line art, sketch art, drawing, black line art, black color, black color, black lines, sketch drawing', '(unrealistic, render, 3d, cgi, cg, 2.5)', [], <PIL.Image.Image image mode=RGBA size=1000x667 at 0x2E415D750>, None, None, None, None, None, None, 20, 'DPM++ 2M SDE Karras', 4, 0, 1, 1, 1, 7, 1.5, 0.94, 0, 512, 512, 1, 0, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x2c3467ca0>, 0, False, '', 0.8, -1, False, -1, 0, 0, 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x2c3467550>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x2c387e500>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x2c387e8f0>, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False, None, None, False, None, None, False, None, None, False, 50) {}
    Traceback (most recent call last):
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/img2img.py", line 208, in img2img
        processed = process_images(p)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "/Users/ikaplan/Code/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/processing.py", line 867, in process_images_inner
        samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
      File "/Users/ikaplan/Code/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/hook.py", line 451, in process_sample
        return process.sample_before_CN_hack(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/processing.py", line 1528, in sample
        samples = self.sampler.sample_img2img(self, self.init_latent, x, conditioning, unconditional_conditioning, image_conditioning=self.image_conditioning)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 188, in sample_img2img
        samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_samplers_common.py", line 261, in launch_sampling
        return func()
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 188, in <lambda>
        samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "/Users/ikaplan/Code/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/repositories/k-diffusion/k_diffusion/sampling.py", line 626, in sample_dpmpp_2m_sde
        denoised = model(x, sigmas[i] * s_in, **extra_args)
      File "/Users/ikaplan/Code/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_samplers_cfg_denoiser.py", line 169, in forward
        x_out = self.inner_model(x_in, sigma_in, cond=make_condition_dict(cond_in, image_cond_in))
      File "/Users/ikaplan/Code/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/repositories/k-diffusion/k_diffusion/external.py", line 112, in forward
        eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/repositories/k-diffusion/k_diffusion/external.py", line 138, in get_eps
        return self.inner_model.apply_model(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_models_xl.py", line 37, in apply_model
        return self.model(x, t, cond)
      File "/Users/ikaplan/Code/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_hijack_utils.py", line 17, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_hijack_utils.py", line 26, in __call__
        return self.__sub_func(self.__orig_func, *args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/modules/sd_hijack_unet.py", line 48, in apply_model
        return orig_func(self, x_noisy.to(devices.dtype_unet), t.to(devices.dtype_unet), cond, **kwargs).float()
      File "/Users/ikaplan/Code/stable-diffusion-webui/repositories/generative-models/sgm/modules/diffusionmodules/wrappers.py", line 28, in forward
        return self.diffusion_model(
      File "/Users/ikaplan/Code/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/hook.py", line 858, in forward_webui
        raise e
      File "/Users/ikaplan/Code/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/hook.py", line 855, in forward_webui
        return forward(*args, **kwargs)
      File "/Users/ikaplan/Code/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/hook.py", line 537, in forward
        param.control_model.aggressive_lowvram()
      File "/Users/ikaplan/Code/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/cldm.py", line 48, in aggressive_lowvram
        self.control_model.label_emb.register_forward_pre_hook(send_me_to_gpu)
      File "/Users/ikaplan/Code/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1614, in __getattr__
        raise AttributeError("'{}' object has no attribute '{}'".format(
    AttributeError: 'ControlNet' object has no attribute 'label_emb'

---

Additional information

No response

huchenlei commented 11 months ago

Please provide your ControlNet configurations, e.g. preprocessor, model, etc. Information you provided cannot reproduce the issue.

www963257827 commented 11 months ago

I have the same problem, plz. image

huchenlei commented 11 months ago

I have the same problem, plz. image

Are you trying to use an SD1.5 ControlNet model on SDXL?

Trikos commented 11 months ago

I have the same issue and cannot resolve. What do you mean by using ControlNet Model on SDXL? How can I avoid it? Ive downloaded all model from https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main and using them. These are my settings immagine immagine immagine

DrDillis commented 11 months ago

exact same issue over here, using the correct new models in the folder, and cant get SDXL to work with it.

DrDillis commented 11 months ago

Make sure that you select an SDXL model and not an older controlnet model.. Thats the mistake I made and now it works, had the same error before and now its fixed.

Trikos commented 11 months ago

Make sure that you select an SDXL model and not an older controlnet model.. Thats the mistake I made and now it works, had the same error before and now its fixed.

How do I know if it's an older control net model? Can you link the new one?

mostwanted002 commented 11 months ago

@Trikos Use models provided here

I had a similar issue, but using these models fixed it.

lastYoueven commented 10 months ago

hub, i trying model not is SDXL with controlnet it is working