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

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

Open wangxuqi opened this issue 2 years ago • 12 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

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'

wangxuqi avatar Feb 18 '23 06:02 wangxuqi

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

hydrian avatar Apr 20 '23 17:04 hydrian

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.

zwpaper avatar Jul 10 '23 07:07 zwpaper

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

Yes, that's the reason

spacexyqc avatar Dec 04 '23 01:12 spacexyqc

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?

UlyssesHeart avatar Dec 04 '23 17:12 UlyssesHeart

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

danielaixer avatar Dec 16 '23 04:12 danielaixer

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

macbookpro2016 avatar Dec 20 '23 08:12 macbookpro2016

这个问题是怎么解决的?

yuesf avatar Jan 04 '24 03:01 yuesf

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??

pothanadithya avatar Feb 09 '24 05:02 pothanadithya

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

ArifSpace avatar Feb 16 '24 02:02 ArifSpace

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.

danielaixer avatar Feb 16 '24 14:02 danielaixer

So? How to solve this problem?

wangwenqiao666 avatar Mar 19 '24 05:03 wangwenqiao666

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...

zwpaper avatar Mar 21 '24 17:03 zwpaper

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

RustieDev avatar Jun 13 '24 20:06 RustieDev