AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
131.71k stars 25.28k forks source link

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

Open chentianyan opened 4 weeks ago

chentianyan commented 4 weeks ago

Checklist

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_implcpu" 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

tieceng commented 4 weeks ago

Thanks, helped me solve this problem

chentianyan commented 4 weeks ago

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 commented 4 weeks ago

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'

1637561204 commented 4 weeks ago

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

1637561204 commented 4 weeks ago

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

then delete "return"

w-e-w commented 4 weeks ago

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

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

FurkanGozukara commented 4 weeks ago

yes i had this error exactly

after several times trying it was fixed

shanghailaofashi001 commented 3 weeks ago

是的,我确实有这个错误

多次尝试后已修复

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

Quakumei commented 1 week ago

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 
reussssya commented 4 hours ago

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.