AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: 'NoneType' object has no attribute 'cond_stage_model' #7902

Open wangxuqi opened 1 year ago

wangxuqi commented 1 year ago

Is there an existing issue for this?

What happened?

Error when prompt after install extension

Steps to reproduce the problem

  1. launch webUI
  2. insert some prompt

What should have happened?

do not error

Commit where the problem happens

3715ece0adce7bf7c5e9c5ab3710b2fdc3848f39

What platforms do you use to access the UI ?

Linux

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--ui-debug-mode

List of extensions

sd-webui-controlnet unprompted

Console logs

Traceback (most recent call last):
  File "/home/qingdu/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/home/qingdu/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/home/qingdu/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/home/qingdu/stable-diffusion-webui/modules/processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "/home/qingdu/stable-diffusion-webui/modules/processing.py", line 544, in process_images_inner
    model_hijack.embedding_db.load_textual_inversion_embeddings()
  File "/home/qingdu/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 229, in load_textual_inversion_embeddings
    self.expected_shape = self.get_expected_shape()
  File "/home/qingdu/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 140, in get_expected_shape
    vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
AttributeError: 'NoneType' object has no attribute 'cond_stage_model'

Traceback (most recent call last):
  File "/home/qingdu/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/home/qingdu/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/home/qingdu/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/home/qingdu/stable-diffusion-webui/modules/processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "/home/qingdu/stable-diffusion-webui/modules/processing.py", line 544, in process_images_inner
    model_hijack.embedding_db.load_textual_inversion_embeddings()
  File "/home/qingdu/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 229, in load_textual_inversion_embeddings
    self.expected_shape = self.get_expected_shape()
  File "/home/qingdu/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 140, in get_expected_shape
    vec = shared.sd_model.cond_stage_model.encode_embedding_init_text(",", 1)
AttributeError: 'NoneType' object has no attribute 'cond_stage_model'
hydrian commented 1 year ago

Any work on this? This is currently making my Pytorch 2.0 environment unusble.

zwpaper commented 12 months ago

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

spacexyqc commented 7 months ago

我最近遇到了这个错误,原来是因为文件损坏了,检查sha256并下载正确的文件,问题就消失了。safetensors

Yes, that's the reason

UlyssesHeart commented 7 months ago

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

Sorry, but what is the sha256?

danielaixer commented 6 months ago

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

Sorry, but what is the sha256?

A checksum to confirm that the file you downloaded to your machine matches the file on the server

macbookpro2016 commented 6 months ago

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

Sorry, but what is the sha256?

A checksum to confirm that the file you downloaded to your machine matches the file on the server

sorry, how to checksum

yuesf commented 6 months ago

这个问题是怎么解决的?

pothanadithya commented 5 months ago

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

how to download that file??

ArifSpace commented 4 months ago

Hello I got same problem when I click Checkpoint or Lora tabs sometimes cant see models, sometimes can see! What should I must do! :)

danielaixer commented 4 months ago

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

how to download that file??

safetensors are one of the common formats for Stable Diffusion model files. There is no specific "safetensors", but depends on the one you're using at the moment. I seems that a corrupt safetensors model file was what was causing the issue for @zwpaper

I meet this error recently, and turn out it is because of the broken safetensors file, check the sha256 and download the correct one, and the issue is gone.

Sorry, but what is the sha256?

A checksum to confirm that the file you downloaded to your machine matches the file on the server

sorry, how to checksum

Calculating a checksum is something common and widely used, not something specific to Stable Diffusion, please just Google it.

wangwenqiao666 commented 3 months ago

So? How to solve this problem?

zwpaper commented 3 months ago

for the ones who don't know how to checksum...

check the safetensor file in huggingface, for example:

https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0_0.9vae.safetensors

just click into it, and you can notice the sha256.

in your terminal, check the downloaded file:

sha256sum sd_xl_base_1.0_0.9vae.safetensors

if they were not matched, please re-download the file.

please do not ask how to solve it more...

RustieDev commented 3 weeks ago

I tried the checksum but that wasn't the issue. When I load of Stable diffusion i first choose the model I want to create the embedding with and generate an image. Just any image. THEN try and create the embedding. Seemed to work for me.

I'm guessing its because the model isn't properly loaded and ready for the embedding if you don't?

P.s. it might also be because of a corrupted chckpoint so if you want just re-download the chckpoint to be safe