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

[Bug]: AttributeError: 'NoneType' object has no attribute 'to'

Open claytonjr opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

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

What happened?

Note: On Colab ControlNet v1.1.173 Downloaded fresh copy of auto1111/controlnet. Attempt to use controlnet/reference_only option, and get the following error: AttributeError: 'NoneType' object has no attribute 'to' (console log below)

Steps to reproduce the problem

  1. Auto1111 on colab
  2. Get latest updates
  3. Click on controlnet,
  4. Input picture (literally any picture)
  5. select reference_only
  6. Click generate button
  7. Get error.

What should have happened?

I should be able to generate a picture of a woman smiling.

Commit where the problem happens

webui: latest colab controlnet: ControlNet v1.1.173 d831043c (Mon May 15 07:18:51 2023)

What browsers do you use to access the UI ?

Brave

Command Line Arguments

Colab, no command line arguments I'm aware of

Console logs

using mask as input
Loading preprocessor: none
preprocessor resolution = 512
  0% 0/20 [00:00<?, ?it/s]
Error completing request
Arguments: ('task(hrwrk7q8kx6snti)', 'woman smiling', '', [], 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, <controlnet.py.UiControlNetUnit object at 0x7f8f79f3a320>, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, False, 50) {}
Traceback (most recent call last):
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 526, in process_images
    res = process_images_inner(p)
  File "/content/gdrive/MyDrive/sd/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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 680, 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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 907, in sample
    samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 377, in sample
    samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 251, in launch_sampling
    return func()
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 377, in <lambda>
    samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/sampling.py", line 145, in sample_euler_ancestral
    denoised = model(x, sigmas[i] * s_in, **extra_args)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py", line 135, in forward
    x_out = self.inner_model(x_in, sigma_in, cond=make_condition_dict([cond_in], image_cond_in))
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/external.py", line 112, in forward
    eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs)
  File "/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/external.py", line 138, in get_eps
    return self.inner_model.apply_model(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_utils.py", line 28, in __call__
    return self.__orig_func(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py", line 858, in apply_model
    x_recon = self.model(x_noisy, t, **cond)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py", line 1329, in forward
    out = self.diffusion_model(x, t, context=cc)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/hook.py", line 432, in forward_webui
    return forward(*args, **kwargs)
  File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/hook.py", line 276, in forward
    param.control_model.to(devices.get_device_for("controlnet"))
AttributeError: 'NoneType' object has no attribute 'to'

Additional information

I'm attempting to try reference_only/controlnet and getting the above error on a fresh download/install. This is via google colab/auto1111.

claytonjr avatar May 15 '23 10:05 claytonjr

Hey Clayton, For what it's worth I have the same problem. I have this happen when I launch with --listen and access Automatic1111 with a remote computer. I do not have this issue if I access locally at 127.0.0.1. I imagine the issue lies somewhere in there. If this is the same for you, lets add that to the "steps to reproduce" as I'm guessing its universal.

brianfertig avatar May 15 '23 15:05 brianfertig

Thanks for reaching out. This is on a colab session, google server. Unless I'm misunderstanding something, I can't listen to local. Also, imo, this is strictly with control net, specifically when enabled is checked. The auto1111 session works as needed otherwise.

On Mon, May 15, 2023, 11:30 brianfertig @.***> wrote:

Hey Clayton, For what it's worth I have the same problem. I have this happen when I launch with --listen and access Automatic1111 with a remote computer. I do not have this issue if I access locally at 127.0.0.1. I imagine the issue lies somewhere in there. If this is the same for you, lets add that to the "steps to reproduce" as I'm guessing its universal.

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

claytonjr avatar May 15 '23 16:05 claytonjr

Hey, just wanted to confirm I have the same issue when starting Automatic1111 with the "--share" option and trying to generate images through the gradio live link on a remote computer. Works fine on the local computer when not using the "--share" option.

Olti81 avatar May 15 '23 21:05 Olti81

interesting - the solution is to close everything, wait for several hours, and problem should be resolved this is mainly because your --share will send your page to servers owned by gradio company, and it seems that the server-side items are not updated, resulting in wrong preprocessor names read by controlnet I am going to close this. Feel free to reopen if problem not solved

lllyasviel avatar May 15 '23 23:05 lllyasviel

Hey, just wanted to confirm I have the same issue when starting Automatic1111 with the "--share" option and trying to generate images through the gradio live link on a remote computer. Works fine on the local computer when not using the "--share" option.

how do you turn the --share option off?

GapMondragon avatar May 22 '23 09:05 GapMondragon

Hi again, just edit the webui-user.bat file with a text editor and remove the --share option from the line where it appears.

From: Gabriel Paolo @.> Sent: mandag 22. mai 2023 11.39 To: @.> Cc: @.>; @.> Subject: Re: [Mikubill/sd-webui-controlnet] [Bug]: AttributeError: 'NoneType' object has no attribute 'to' (Issue #1289)

Hey, just wanted to confirm I have the same issue when starting Automatic1111 with the "--share" option and trying to generate images through the gradio live link on a remote computer. Works fine on the local computer when not using the "--share" option.

how do you turn the --share option off?

— Reply to this email directly, view it on GitHubhttps://github.com/Mikubill/sd-webui-controlnet/issues/1289#issuecomment-1556890734, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUIG4UXX3Z4K2J4EQBPW3JDXHMX43ANCNFSM6AAAAAAYCAE6DU. You are receiving this because you commented.Message ID: @.***>

Olti81 avatar May 22 '23 09:05 Olti81

Hi again, just edit the webui-user.bat file with a text editor and remove the --share option from the line where it appears. From: Gabriel Paolo @.> Sent: mandag 22. mai 2023 11.39 To: @.> Cc: @.>; @.> Subject: Re: [Mikubill/sd-webui-controlnet] [Bug]: AttributeError: 'NoneType' object has no attribute 'to' (Issue #1289) Hey, just wanted to confirm I have the same issue when starting Automatic1111 with the "--share" option and trying to generate images through the gradio live link on a remote computer. Works fine on the local computer when not using the "--share" option. how do you turn the --share option off? — Reply to this email directly, view it on GitHub<#1289 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUIG4UXX3Z4K2J4EQBPW3JDXHMX43ANCNFSM6AAAAAAYCAE6DU. You are receiving this because you commented.Message ID: @.***>

ill try that. Thank you!!

GapMondragon avatar May 22 '23 11:05 GapMondragon

Hello @lllyasviel,

I am still getting this error no matter how long I wait and how many times I restart the colab. I've been trying for days to get ControlNet, any ControlNet, to work, but I still just get this same AttributeError. I've tried deleting --share (though I don't think this matters since I'm not using a local installation). I've tried disconnecting and waiting for hours, but it still isn't working. I'm not sure what I'm doing wrong.

I am using Google Colab to use Auto1111, so there isn't much I can do in terms of local downloads. If there is some setting or file I should try modifying, please let me know! Thank you!

genialgenteel avatar May 23 '23 02:05 genialgenteel

+1 @lllyasviel however not running on local machine, attempting to input an image with ControlNet, reference only, enable and some text inputs.

initiating with ./webui.sh --skip-torch-cuda-test --no-half --use-cpu all so the --shared option mentioned earlier I'm not using anyways.

birchcode avatar May 27 '23 15:05 birchcode

@birchcode @nasjp @bjornlarssen Hey, just letting you guys know that ControlNet is working for me now. One of two things may have gotten it to work. Either:

  1. Updating it to the latest version v1.1.201 (along with AUTO1111, gradio, etc.), or
  2. Disabling certain web browser extensions got it to work.

I have a strong suspicion the answer is number 2 rather than 1. The reason is that, for the longest time, Inpainting also didn't work for me. Every time I tried to draw a mask and generated, it ignored the mask and distorted the entire picture, no matter which options I selected. It was like this for months, so I gave up on it just like I gave up on ControlNet. I never got it to work until today, when a random discovery that it worked in Chrome and not Firefox allowed me to narrow down the problem first to the browser, then the browser extension.

Check this issue here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1738

Lemme know if this works for you. I'm still popping off that my Inpainting is finally working, and this is just the cherry on top!

genialgenteel avatar May 28 '23 19:05 genialgenteel

@genialgenteel I tryed your answer 2 and it worked. I can generate images and reference_only seems to work.But when I use reference_only every first time,the command line display errors like this param.control_model.to(devices.get_device_for("controlnet")) AttributeError: 'NoneType' object has no attribute 'to' same as https://github.com/Mikubill/sd-webui-controlnet/issues/1289#issue-1709833136. I think there is still a bug that needs to be fixed but thank your answer anyway.

cappuccoco avatar May 31 '23 10:05 cappuccoco