stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

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

Open chentianyan opened this issue 1 year ago • 9 comments
trafficstars

Checklist

  • [ ] The issue exists after disabling all extensions
  • [X] The issue exists on a clean installation of webui
  • [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [ ] The issue exists in the current version of the webui
  • [ ] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

My system is macos 12.7.4 Intel version, and when I use Stable Diffusion to generate images, an error message will appear AttributeError: 'NoneType' object has no attribute 'lowvram'

Steps to reproduce the problem

*** Arguments: ('task(mibj0wz28dpqrbg)', <gradio.routes.Request object at 0x1576478b0>, 'a age', '', [], 1, 1, 7, 80, 80, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 12, 'DPM++ 2M SDE', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}

What should have happened?

There should be no lack of object attributes, and images should be generated correctly

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

*** Error completing request *** Arguments: ('task(mibj0wz28dpqrbg)', <gradio.routes.Request object at 0x1576478b0>, 'a age', '', [], 1, 1, 7, 80, 80, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 12, 'DPM++ 2M SDE', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {} Traceback (most recent call last): File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 57, in f res = list(func(*args, **kwargs)) File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 36, in f res = func(*args, **kwargs) File "/Volumes/d/stable-diffusion-webui/modules/txt2img.py", line 109, in txt2img processed = processing.process_images(p) File "/Volumes/d/stable-diffusion-webui/modules/processing.py", line 832, in process_images sd_models.reload_model_weights() File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer) File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded send_model_to_cpu(sd_model) File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu if m.lowvram: AttributeError: 'NoneType' object has no attribute 'lowvram'


Restarting UI... Closing server running on port: 7860 Exception in thread Thread-5 (load_model): Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/Volumes/d/stable-diffusion-webui/modules/initialize.py", line 154, in load_model devices.first_time_calculation() File "/Volumes/d/stable-diffusion-webui/modules/devices.py", line 267, in first_time_calculation linear(x) File "/Users/chen/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in call_impl return forward_call(*input, **kwargs) File "/Volumes/d/stable-diffusion-webui/extensions-builtin/Lora/networks.py", line 503, in network_Linear_forward return originals.Linear_forward(self, input) File "/Users/chen/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 114, in forward return F.linear(input, self.weight, self.bias) RuntimeError: "addmm_impl_cpu" not implemented for 'Half' Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Startup time: 2.2s (load scripts: 0.6s, create ui: 0.7s, gradio launch: 0.7s). *** Error completing request *** Arguments: ('task(l6jfsml94tlvjlp)', <gradio.routes.Request object at 0x15875c130>, 'a dog', '', [], 1, 1, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {} Traceback (most recent call last): File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 57, in f res = list(func(*args, **kwargs)) File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 36, in f res = func(*args, **kwargs) File "/Volumes/d/stable-diffusion-webui/modules/txt2img.py", line 109, in txt2img processed = processing.process_images(p) File "/Volumes/d/stable-diffusion-webui/modules/processing.py", line 832, in process_images sd_models.reload_model_weights() File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer) File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded send_model_to_cpu(sd_model) File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu if m.lowvram: AttributeError: 'NoneType' object has no attribute 'lowvram'

Console logs

*** Error completing request
*** Arguments: ('task(mibj0wz28dpqrbg)', <gradio.routes.Request object at 0x1576478b0>, 'a age', '', [], 1, 1, 7, 80, 80, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 12, 'DPM++ 2M SDE', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "/Volumes/d/stable-diffusion-webui/modules/txt2img.py", line 109, in txt2img
        processed = processing.process_images(p)
      File "/Volumes/d/stable-diffusion-webui/modules/processing.py", line 832, in process_images
        sd_models.reload_model_weights()
      File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights
        sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer)
      File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded
        send_model_to_cpu(sd_model)
      File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu
        if m.lowvram:
    AttributeError: 'NoneType' object has no attribute 'lowvram'

---
Restarting UI...
Closing server running on port: 7860
Exception in thread Thread-5 (load_model):
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Volumes/d/stable-diffusion-webui/modules/initialize.py", line 154, in load_model
    devices.first_time_calculation()
  File "/Volumes/d/stable-diffusion-webui/modules/devices.py", line 267, in first_time_calculation
    linear(x)
  File "/Users/chen/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Volumes/d/stable-diffusion-webui/extensions-builtin/Lora/networks.py", line 503, in network_Linear_forward
    return originals.Linear_forward(self, input)
  File "/Users/chen/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 114, in forward
    return F.linear(input, self.weight, self.bias)
RuntimeError: "addmm_impl_cpu_" not implemented for 'Half'
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 2.2s (load scripts: 0.6s, create ui: 0.7s, gradio launch: 0.7s).
*** Error completing request
*** Arguments: ('task(l6jfsml94tlvjlp)', <gradio.routes.Request object at 0x15875c130>, 'a dog', '', [], 1, 1, 7, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 0, 20, 'DPM++ 2M', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "/Volumes/d/stable-diffusion-webui/modules/call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "/Volumes/d/stable-diffusion-webui/modules/txt2img.py", line 109, in txt2img
        processed = processing.process_images(p)
      File "/Volumes/d/stable-diffusion-webui/modules/processing.py", line 832, in process_images
        sd_models.reload_model_weights()
      File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights
        sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer)
      File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded
        send_model_to_cpu(sd_model)
      File "/Volumes/d/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu
        if m.lowvram:
    AttributeError: 'NoneType' object has no attribute 'lowvram'

Additional information

No response

chentianyan avatar Apr 22 '24 14:04 chentianyan

Thanks, helped me solve this problem

tieceng avatar Apr 23 '24 07:04 tieceng

Thank you, but the problem still hasn't been resolved. I created whatever. safesensors and placed them in the Stable diffusion, but it still doesn't work. I entered http://127.0.0.1:7860/ The Stable Diffusion checkpoint will automatically display the first model in the models, and when I switch models, it cannot be changed and will be reset to the first model. At the same time, the terminal shows that the model I switch to is AttributeError: 'NoneType' object has no attribute 'lowvram'.

chentianyan avatar Apr 23 '24 13:04 chentianyan

changing setting sd_model_checkpoint to sd-v1-5-inpainting.ckpt: AttributeError Traceback (most recent call last): File "/Users/chen/stable-diffusion-webui/modules/options.py", line 165, in set option.onchange() File "/Users/chen/stable-diffusion-webui/modules/call_queue.py", line 13, in f res = func(*args, **kwargs) File "/Users/chen/stable-diffusion-webui/modules/initialize_util.py", line 181, in shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded send_model_to_cpu(sd_model) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu if m.lowvram: AttributeError: 'NoneType' object has no attribute 'lowvram'

changing setting sd_model_checkpoint to revAnimated_v122EOL.safetensors: AttributeError Traceback (most recent call last): File "/Users/chen/stable-diffusion-webui/modules/options.py", line 165, in set option.onchange() File "/Users/chen/stable-diffusion-webui/modules/call_queue.py", line 13, in f res = func(*args, **kwargs) File "/Users/chen/stable-diffusion-webui/modules/initialize_util.py", line 181, in shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded send_model_to_cpu(sd_model) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu if m.lowvram: AttributeError: 'NoneType' object has no attribute 'lowvram'

changing setting sd_model_checkpoint to whatever.safetensors: AttributeError Traceback (most recent call last): File "/Users/chen/stable-diffusion-webui/modules/options.py", line 165, in set option.onchange() File "/Users/chen/stable-diffusion-webui/modules/call_queue.py", line 13, in f res = func(*args, **kwargs) File "/Users/chen/stable-diffusion-webui/modules/initialize_util.py", line 181, in shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded send_model_to_cpu(sd_model) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu if m.lowvram: AttributeError: 'NoneType' object has no attribute 'lowvram'

changing setting sd_model_checkpoint to sd-v1-4.ckpt: AttributeError Traceback (most recent call last): File "/Users/chen/stable-diffusion-webui/modules/options.py", line 165, in set option.onchange() File "/Users/chen/stable-diffusion-webui/modules/call_queue.py", line 13, in f res = func(*args, **kwargs) File "/Users/chen/stable-diffusion-webui/modules/initialize_util.py", line 181, in shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: sd_models.reload_model_weights()), call=False) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 860, in reload_model_weights sd_model = reuse_model_from_already_loaded(sd_model, checkpoint_info, timer) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 793, in reuse_model_from_already_loaded send_model_to_cpu(sd_model) File "/Users/chen/stable-diffusion-webui/modules/sd_models.py", line 662, in send_model_to_cpu if m.lowvram: AttributeError: 'NoneType' object has no attribute 'lowvram'

chentianyan avatar Apr 23 '24 13:04 chentianyan

Adding “Return” to the first line of modules/sd_models.py solves the problem. image

1637561204 avatar Apr 23 '24 16:04 1637561204

Adding “Return” to the first line of modules/sd_models.py solves the problem. image

then delete "return"

1637561204 avatar Apr 23 '24 16:04 1637561204

Thank you, but the problem still hasn't been resolved. I created whatever. safesensors and placed them in the Stable diffusion, but it still doesn't work. I entered http://127.0.0.1:7860/ The Stable Diffusion checkpoint will automatically display the first model in the models, and when I switch models, it cannot be changed and will be reset to the first model. At the same time, the terminal shows that the model I switch to is AttributeError: 'NoneType' object has no attribute 'lowvram'.

you completely misunderstand what a Pull Request is a Pull Request (PR) is a proposal of a change in the code to achieve something in this case it was to solve this issue in the code base so it doesn't happen again

and naturally the description I gave is what this code trying to achieve I also provided a method to replicate the issue if someone wishes to test

I wasn't telling anyone to create a whatever.safesensors to "solve the issue" it is for people who wish to test if this issue exists. and if this fix PR would fix the issue

  • you saw https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15600 because I referenced this as one of the issues that the PR will solved

if you follow the other issue poster I linked on the PR you would see more information including potential methods of solving the issue

w-e-w avatar Apr 23 '24 17:04 w-e-w

yes i had this error exactly

after several times trying it was fixed

FurkanGozukara avatar Apr 23 '24 21:04 FurkanGozukara

是的,我确实有这个错误

多次尝试后已修复

Could you please tell me in detail how to fix it?

shanghailaofashi001 avatar Apr 25 '24 04:04 shanghailaofashi001

I also ran into the issue. In my case it occured when I tried to use EasyPhoto extension and train a LoRA model via API only. The solution for my case was to remove --skip-load-model-at-start flag.

I think my solution works because "m" in the image below becomes the actual model and not None. However, if flag is present and no model is loaded, "m" is indeed None and therefore doesn't have any attributes.

Adding “Return” to the first line of modules/sd_models.py solves the problem. image

I believe for that case a check should be implemented, e.g.

if m is None:
    return 

Quakumei avatar May 13 '24 23:05 Quakumei

Have same issue, how can I solve, ur solving, guys, is quite incorrect, bcs if I will remake function as u wrote I could have UB ig so.

reussssya avatar May 21 '24 18:05 reussssya

same problem

dionisvl avatar May 26 '24 12:05 dionisvl

same problem

Hwatu avatar May 28 '24 06:05 Hwatu

same problem

lx78WyY0J5 avatar May 30 '24 22:05 lx78WyY0J5

same problem, while running side by side with forge, apparently while model is hogged by forge it's considered "corrupted" by a1111

aolko avatar Jun 01 '24 22:06 aolko

somehow fixed by playing with COMMANDLINE_ARGS , only --xformers left in args, seems like works

reussssya avatar Jun 08 '24 14:06 reussssya

somehow fixed by playing with COMMANDLINE_ARGS , only --xformers left in args, seems like works

post before and after, please?

aolko avatar Jun 08 '24 20:06 aolko

I could replicate this exact error.

In my case, I had a .ckpt sd checkpoint that was renamed as .safetensors. After discovering it and renaming it to the correct extension it worked.

Rucadi avatar Jun 09 '24 10:06 Rucadi

In my case, this error happens just after the SD-webui start, when the model is loaded, but optimization isn't applied yet. So the interface is completely functional, you can change parameters and select a different model, but it doesn't change because of the error. Then, after some time (around 5 minutes), I see this line in the console: Applying attention optimization: xformers... done., and after that changing the model works correctly.

Mortasen avatar Jun 11 '24 19:06 Mortasen

Adding “Return” to the first line of modules/sd_models.py solves the problem. image

worked for me, now says a different error, so that's progress, right?

DuncanParSky avatar Jun 17 '24 08:06 DuncanParSky

sorry, how to solve this issue?

HobbyUlimited avatar Jul 06 '24 14:07 HobbyUlimited

Adding “Return” to the first line of modules/sd_models.py solves the problem. image

how to get to this view?

HobbyUlimited avatar Jul 06 '24 14:07 HobbyUlimited

FYI: See https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/2b717bb195a3034853ed45a52c5752f010e1302b.

vladfaust avatar Sep 01 '24 15:09 vladfaust