sd-webui-controlnet icon indicating copy to clipboard operation
sd-webui-controlnet copied to clipboard

Error: 'NoneType' object has no attribute 'shape'

Open LexVolkov opened this issue 2 years ago • 14 comments

in txt2img tab have an error 'NoneType' object has no attribute 'shape' when try use control net with canny

Error completing request Arguments: ('task(4xiu5obdiohh5gn)', 'a cat', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, [], 0, False, 7, 100, 'Constant', 0, 'Constant', 0, 4, False, 'x264', 'mci', 10, 0, False, True, True, True, 'intermediate', 'animation', True, 'canny', 'control_sd15_canny [fef5e48e]', 1, None, False, 'Just Resize', False, False, False, False, 'positive', 'comma', False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 'Not set', True, True, '', '', '', '', '', 1.3, 'Not set', 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', 1.3, 'Not set', False, 'None') {} Traceback (most recent call last): File "W:\stable-diffusion-webui-master\modules\call_queue.py", line 56, in f res = list(func(*args, **kwargs)) File "W:\stable-diffusion-webui-master\modules\call_queue.py", line 37, in f res = func(*args, **kwargs) File "W:\stable-diffusion-webui-master\modules\txt2img.py", line 56, in txt2img processed = process_images(p) File "W:\stable-diffusion-webui-master\modules\processing.py", line 486, in process_images res = process_images_inner(p) File "W:\stable-diffusion-webui-master\modules\processing.py", line 628, in process_images_inner samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength, prompts=prompts) File "W:\stable-diffusion-webui-master\modules\processing.py", line 828, in sample samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x)) File "W:\stable-diffusion-webui-master\modules\sd_samplers_kdiffusion.py", line 323, in sample samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={ File "W:\stable-diffusion-webui-master\modules\sd_samplers_kdiffusion.py", line 221, in launch_sampling return func() File "W:\stable-diffusion-webui-master\modules\sd_samplers_kdiffusion.py", line 323, in samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={ File "W:\stable-diffusion-webui-master\venv\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "W:\stable-diffusion-webui-master\repositories\k-diffusion\k_diffusion\sampling.py", line 145, in sample_euler_ancestral denoised = model(x, sigmas[i] * s_in, **extra_args) File "W:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "W:\stable-diffusion-webui-master\modules\sd_samplers_kdiffusion.py", line 116, in forward x_out = self.inner_model(x_in, sigma_in, cond={"c_crossattn": [cond_in], "c_concat": [image_cond_in]}) File "W:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "W:\stable-diffusion-webui-master\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 "W:\stable-diffusion-webui-master\repositories\k-diffusion\k_diffusion\external.py", line 138, in get_eps return self.inner_model.apply_model(*args, **kwargs) File "W:\stable-diffusion-webui-master\modules\sd_hijack_utils.py", line 17, in setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs)) File "W:\stable-diffusion-webui-master\modules\sd_hijack_utils.py", line 28, in call return self.__orig_func(*args, **kwargs) File "W:\stable-diffusion-webui-master\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 858, in apply_model x_recon = self.model(x_noisy, t, **cond) File "W:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "W:\stable-diffusion-webui-master\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1329, in forward out = self.diffusion_model(x, t, context=cc) File "W:\stable-diffusion-webui-master\venv\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "W:\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\cldm.py", line 114, in forward2 return forward(*args, **kwargs) File "W:\stable-diffusion-webui-master\extensions\sd-webui-controlnet\scripts\cldm.py", line 75, in forward if abs(x.shape[-1] - outer.hint_cond.shape[-1] // 8) > 8: AttributeError: 'NoneType' object has no attribute 'shape'

LexVolkov avatar Feb 16 '23 18:02 LexVolkov

this happens if nothing is thrown into the canvas

LexVolkov avatar Feb 16 '23 18:02 LexVolkov

the update fixed everything

LexVolkov avatar Feb 16 '23 18:02 LexVolkov

no, this error still occurs.

LexVolkov avatar Feb 16 '23 19:02 LexVolkov

Can confirm that this error is happening now even if canvas has content on it.

David-Gianotti avatar Feb 16 '23 19:02 David-Gianotti

Can confirm that this error is happening now even if canvas has content on it.

Are you update?

LexVolkov avatar Feb 16 '23 19:02 LexVolkov

Can confirm that this error is happening now even if canvas has content on it.

Are you update?

Yes, everything up to date. It's not happening now, back to issue #68 still happening.

David-Gianotti avatar Feb 16 '23 20:02 David-Gianotti

Can confirm that this error is happening now even if canvas has content on it.

Are you update?

Yes, everything up to date. It's not happening now, back to issue #68 still happening.

close the SD window and run again and try to use the controlnet on txt2img. will the error return will .

LexVolkov avatar Feb 16 '23 21:02 LexVolkov

I'm on the latest version and I'm getting the error.

Mousewrites avatar Feb 16 '23 21:02 Mousewrites

Can confirm that this error is happening now even if canvas has content on it.

Are you update?

Yes, everything up to date. It's not happening now, back to issue #68 still happening.

close the SD window and run again and try to use the controlnet on txt2img. will the error return will .

This error isn't happening now. The MPS crashing issue from #68 is still happening.

David-Gianotti avatar Feb 16 '23 22:02 David-Gianotti

Try restarting Stable Diffusion after you update it. That seemed to work for me.

CyberLykan avatar Feb 16 '23 23:02 CyberLykan

I can attest that updating and restarting SD fixed this for me.

Philbuck84 avatar Feb 16 '23 23:02 Philbuck84

same problem here, using the latest sd and latest extension, not happen in openpose but seems happen in the most other models.

Update: It looks like the problem can be traced to the model corrption (unfinished downloading) of the preprocessor. By comparing the model file size between X:\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\[preprocessor] and models here: https://huggingface.co/lllyasviel/ControlNet/tree/main/annotator/ckpts, I've found my model size is much smaller than those.

If you are living in a place with poor network quality, as I am (living in mainland China and always affected by the GFW), then I think the cause is most likely the model corruption -- which means you might need to redownload ckpts above.

zhmou avatar Feb 17 '23 11:02 zhmou

I had some problem and i bother me for two days.

And I found the solution from this Chinese article:

https://www.bilibili.com/read/cv19906113?from=search

I follow the article and install the certificate.command, and it works.

Here is what I did:

  1. Search "Certificates.command" in finder.
  2. Double clink to install it
  3. Restart webui

It works for me!

wilsw645 avatar Feb 17 '23 15:02 wilsw645

Update: It looks like the problem can be traced to the model corrption (unfinished downloading) of the preprocessor. By comparing the model file size between X:\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\[preprocessor] and models here: https://huggingface.co/lllyasviel/ControlNet/tree/main/annotator/ckpts, I've found my model size is much smaller than those.

If you are living in a place with poor network quality, as I am (living in mainland China and always affected by the GFW), then I think the cause is most likely the model corruption -- which means you might need to redownload ckpts above.

牛的老哥,我也是这个问题。

Can confirm that bad networking does lead to file corruption. Yeah, surprise, I live in mainland China as well. A similar issue bugged me for quite a while. Whenever I use 'depth' or 'normal_map' as the preprocessor, this error pops up: AssertionError: Controlnet is enabled but no input image is given. I followed the steps mentioned above. I do find my ...\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\midas\dpt_hybrid-midas-501f0c75.pt corrupted. All good for now after fixing it. Hopefully, your problems can be solved by updating the extension or re-downloading some files. Happy prompting!

stinghxk avatar Feb 18 '23 18:02 stinghxk