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

[Bug]:

Open cenap opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

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

What happened?

Getting AttributeError: 'Textbox' object has no attribute 'elem_classes' when starting the program

Steps to reproduce the problem

  1. Git pull for latest repo
  2. Run webui-user.bat
  3. Won't start giving errors in console

What should have happened?

Should start normally

Commit where the problem happens

64da5c46ef0d68b9048747c2e0d46ce3495f9f29

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

Launching Web UI with arguments: --xformers --medvram --opt-split-attention

List of extensions

Dreembooth ControlNet

Console logs

venv "E:\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Commit hash: 532ac22b3889e7e1564e9c893622da713a19679c
Installing requirements for Web UI


#######################################################################################################
Initializing Dreambooth
If submitting an issue on github, please provide the below text for debugging purposes:

Python revision: 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Dreambooth revision: 8e5e48178f1b0a92d798630e3e7cc31a65a63493
SD-WebUI revision: 532ac22b3889e7e1564e9c893622da713a19679c

Checking Dreambooth requirements...
[+] bitsandbytes version 0.35.0 installed.
[+] diffusers version 0.10.2 installed.
[+] transformers version 4.25.1 installed.
[+] xformers version 0.0.14.dev0 installed.
[+] torch version 1.13.1+cu117 installed.
[+] torchvision version 0.14.1+cu117 installed.

#######################################################################################################

Launching Web UI with arguments: --xformers --medvram --opt-split-attention
SD-Webui API layer loaded
Loading weights [429e57892e] from E:\stable-diffusion-webui\models\Stable-diffusion\cenap-dreambooth.ckpt
Creating model from config: E:\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: E:\stable-diffusion-webui\models\VAE\vae-ft-mse-840000-ema-pruned.ckpt
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0):
Model loaded in 3.1s (load weights from disk: 1.0s, create model: 0.4s, apply weights to model: 0.7s, apply half(): 0.7s, load VAE: 0.3s).
Traceback (most recent call last):
  File "E:\stable-diffusion-webui\modules\ui.py", line 460, in create_ui
    txt2img_prompt, txt2img_prompt_styles, txt2img_negative_prompt, submit, _, _, txt2img_prompt_style_apply, txt2img_save_style, txt2img_paste, extra_networks_button, token_counter, token_button, negative_token_counter, negative_token_button = create_toprow(is_img2img=False)
  File "E:\stable-diffusion-webui\modules\ui.py", line 288, in create_toprow
    prompt = gr.Textbox(label="Prompt", elem_id=f"{id_part}_prompt", show_label=False, lines=3, placeholder="Prompt (press Ctrl+Enter or Alt+Enter to generate)")
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 331, in __init__
    IOComponent.__init__(
  File "E:\stable-diffusion-webui\modules\scripts.py", line 544, in IOComponent_init
    add_classes_to_gradio_component(self)
  File "E:\stable-diffusion-webui\modules\scripts.py", line 529, in add_classes_to_gradio_component
    comp.elem_classes = ["gradio-" + comp.get_block_name(), *(comp.elem_classes or [])]
AttributeError: 'Textbox' object has no attribute 'elem_classes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\stable-diffusion-webui\launch.py", line 352, in <module>
    start()
  File "E:\stable-diffusion-webui\launch.py", line 347, in start
    webui.webui()
  File "E:\stable-diffusion-webui\webui.py", line 243, in webui
    shared.demo = modules.ui.create_ui()
  File "E:\stable-diffusion-webui\modules\ui.py", line 459, in create_ui
    with gr.Blocks(analytics_enabled=False) as txt2img_interface:
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1095, in __exit__
    self.config = self.get_config_file()
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1071, in get_config_file
    "props": utils.delete_none(block.get_config())
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 352, in get_config
    "type": self.type,
AttributeError: 'Textbox' object has no attribute 'type'. Did you mean: 'style'?
Press any key to continue . . .

Additional information

No response

cenap avatar Mar 26 '23 08:03 cenap

ME TOO LatentDiffusion: Running in v-prediction mode DiffusionWrapper has 865.91 M params. Applying xformers cross attention optimization. Textual inversion embeddings loaded(0): Model loaded in 8.8s (load weights from disk: 3.8s, find config: 1.2s, create model: 0.2s, apply weights to model: 0.6s, apply half(): 0.7s, move model to device: 0.5s, load textual inversion embeddings: 1.8s). Traceback (most recent call last): File "E:\code\stable-diffusion-webui-master\launch.py", line 352, in start() File "E:\code\stable-diffusion-webui-master\launch.py", line 347, in start webui.webui() File "E:\code\stable-diffusion-webui-master\webui.py", line 243, in webui shared.demo = modules.ui.create_ui() File "E:\code\stable-diffusion-webui-master\modules\ui.py", line 461, in create_ui txt2img_prompt, txt2img_prompt_styles, txt2img_negative_prompt, submit, _, _, txt2img_prompt_style_apply, txt2img_save_style, txt2img_paste, extra_networks_button, token_counter, token_button, negative_token_counter, negative_token_button = create_toprow(is_img2img=False) File "E:\code\stable-diffusion-webui-master\modules\ui.py", line 289, in create_toprow prompt = gr.Textbox(label="Prompt", elem_id=f"{id_part}_prompt", show_label=False, lines=3, placeholder="Prompt (press Ctrl+Enter or Alt+Enter to generate)") File "E:\code\stable-diffusion-webui-master\venv\lib\site-packages\gradio\components.py", line 302, in init IOComponent.init( File "E:\code\stable-diffusion-webui-master\modules\scripts.py", line 544, in IOComponent_init add_classes_to_gradio_component(self) File "E:\code\stable-diffusion-webui-master\modules\scripts.py", line 529, in add_classes_to_gradio_component comp.elem_classes = ["gradio-" + comp.get_block_name(), *(comp.elem_classes or [])] AttributeError: 'Textbox' object has no attribute 'elem_classes' 请按任意键继续. . .

what can i do?

mingmars avatar Mar 26 '23 13:03 mingmars

image

我已经临时解决了 用之前老版本的三个文件替换掉现在的就可以启动了

stable-diffusion-webui-master\modules
ui, ui_common ,scripts

mingmars avatar Mar 26 '23 13:03 mingmars

image

我已经临时解决了 用之前老版本的三个文件替换掉现在的就可以启动了

stable-diffusion-webui-master\modules ui, ui_common ,scripts

Do you have a download link for the previous version please? I am going throught the same issue here: Untitled

AudioStick avatar Mar 26 '23 15:03 AudioStick

I got the same error:

MacOS

(web-ui) ppt@pptdeMacBook-Pro stable-diffusion-webui % python webui.py --precision full --no-half --opt-split-attention-v1 --listen
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
No module 'xformers'. Proceeding without it.
/Users/ppt/miniconda/envs/web-ui/lib/python3.10/site-packages/torchvision/transforms/functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
  warnings.warn(
Skipping broken symlink: /Users/ppt/Github/stable-diffusion-webui/models/Stable-diffusion/naked_4k_vnv.ckpt
Error loading script: training_picker.py
Traceback (most recent call last):
  File "/Users/ppt/Github/stable-diffusion-webui/modules/scripts.py", line 256, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/Users/ppt/Github/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/ppt/Github/stable-diffusion-webui/extensions/training-picker/scripts/training_picker.py", line 16, in <module>
    from modules.ui import create_refresh_button, folder_symbol
ImportError: cannot import name 'folder_symbol' from 'modules.ui' (/Users/ppt/Github/stable-diffusion-webui/modules/ui.py)

(Unprompted v0.6.0 by Therefore Games)
(SETUP) Initializing Unprompted object...
(SETUP) Loading configuration files...
(SETUP) Debug mode is False
Loading weights [c1a138f549] from /Users/ppt/Github/stable-diffusion-webui/models/Stable-diffusion/HassanBlend1.4.ckpt
Creating model from config: /Users/ppt/Github/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying v1 cross attention optimization.
Textual inversion embeddings loaded(1): embeddings
Model loaded in 13.5s (load weights from disk: 3.7s, create model: 1.1s, apply weights to model: 2.9s, move model to device: 5.8s).
Traceback (most recent call last):
  File "/Users/ppt/Github/stable-diffusion-webui/webui.py", line 343, in <module>
    webui()
  File "/Users/ppt/Github/stable-diffusion-webui/webui.py", line 243, in webui
    shared.demo = modules.ui.create_ui()
  File "/Users/ppt/Github/stable-diffusion-webui/modules/ui.py", line 460, in create_ui
    txt2img_prompt, txt2img_prompt_styles, txt2img_negative_prompt, submit, _, _, txt2img_prompt_style_apply, txt2img_save_style, txt2img_paste, extra_networks_button, token_counter, token_button, negative_token_counter, negative_token_button = create_toprow(is_img2img=False)
  File "/Users/ppt/Github/stable-diffusion-webui/modules/ui.py", line 288, in create_toprow
    prompt = gr.Textbox(label="Prompt", elem_id=f"{id_part}_prompt", show_label=False, lines=3, placeholder="Prompt (press Ctrl+Enter or Alt+Enter to generate)")
  File "/Users/ppt/miniconda/envs/web-ui/lib/python3.10/site-packages/gradio/components.py", line 302, in __init__
    IOComponent.__init__(
  File "/Users/ppt/Github/stable-diffusion-webui/modules/scripts.py", line 544, in IOComponent_init
    add_classes_to_gradio_component(self)
  File "/Users/ppt/Github/stable-diffusion-webui/modules/scripts.py", line 529, in add_classes_to_gradio_component
    comp.elem_classes = ["gradio-" + comp.get_block_name(), *(comp.elem_classes or [])]
AttributeError: 'Textbox' object has no attribute 'elem_classes'
(web-ui) ppt@pptdeMacBook-Pro stable-diffusion-webui % 

FreeBlues avatar Mar 26 '23 18:03 FreeBlues

image 我已经临时解决了 用之前老版本的三个文件替换掉现在的就可以启动了 stable-diffusion-webui-master\modules ui, ui_common ,scripts

Do you have a download link for the previous version please? I am going throught the same issue here: Untitled

Here is the diff files:

https://github.com/AUTOMATIC1111/stable-diffusion-webui/compare/master@%7B3.day.ago%7D...master?diff=split

FreeBlues avatar Mar 26 '23 19:03 FreeBlues

same issue after pulled the latest code

Season02 avatar Mar 27 '23 11:03 Season02

I rolled back to commit a9fed7c364061ae6efb37f797b6b522cb3cf7aa2 Date: Tue Mar 14 11:28:13 2023 +0300

There have been quite a few commits between Mar 14 and today. I can't guarantee that there is not a more recent working version. I tried quite a few commits along the way, then got sick of it and stepped back day by day.

For those that are wondering how to do this, in your stable-diffusion-webui diectory, cmd shell

git checkout a9fed7c364061ae6efb37f797b6b522cb3cf7aa2

At some point in the future when it seems likely that the problem has been fixed:

git checkout master git pull

vannoo67 avatar Mar 27 '23 12:03 vannoo67

After latest commits the error has changed to "AttributeError: 'Blocks' object has no attribute 'elem_classes'" but still not starting

cenap avatar Mar 27 '23 15:03 cenap

I rolled back to commit a9fed7c Date: Tue Mar 14 11:28:13 2023 +0300

There have been quite a few commits between Mar 14 and today. I can't guarantee that there is not a more recent working version. I tried quite a few commits along the way, then got sick of it and stepped back day by day.

For those that are wondering how to do this, in your stable-diffusion-webui diectory, cmd shell

git checkout a9fed7c

At some point in the future when it seems likely that the problem has been fixed:

git checkout master git pull

I am trying to currently fix the bug myself, but I can't rollback to an old version. I noticed that the error is in the scripts.py file (/modules). Could you please send me the the lines from the row 524 to 532? I know this is a weird thing to task... (yes this is my first time trying to fix anything complicated). But thank you in forwand

Nicoolodion avatar Mar 27 '23 17:03 Nicoolodion

I rolled back to commit a9fed7c Date: Tue Mar 14 11:28:13 2023 +0300

There have been quite a few commits between Mar 14 and today. I can't guarantee that there is not a more recent working version. I tried quite a few commits along the way, then got sick of it and stepped back day by day.

For those that are wondering how to do this, in your stable-diffusion-webui diectory, cmd shell

git checkout a9fed7c

At some point in the future when it seems likely that the problem has been fixed:

git checkout master git pull

ThankYOU!!

AudioStick avatar Mar 27 '23 17:03 AudioStick

Just managed to do kind of a fix, it starts, but the ui is broken now😅

Nicoolodion avatar Mar 27 '23 17:03 Nicoolodion

Could you please send me the the lines from the row 524 to 532?

Sure thing, see below. But I've got to say, you're going to drive yourself nuts trying to do this without access to the various commits. (There are quite a few between this last-known-good and the current release.)

I strongly suggest that you use git to pull the repo (even if its not your active stable-diffusion-webui installation). At that point you can do diffs on the various versions to your heart's content.

Happy to help with this code snippet, but I'm not going to follow you down that rabbit hole.

    script_callbacks.after_component_callback(self, **kwargs)

    if scripts_current is not None:
        scripts_current.after_component(self, **kwargs)

    return res


original_IOComponent_init = gr.components.IOComponent.__init__

vannoo67 avatar Mar 27 '23 17:03 vannoo67

ThankYOU!!

No problem. I knew it would be a drag for a lot of folks.

vannoo67 avatar Mar 27 '23 17:03 vannoo67

I have managed to identify the commit that introduced the issue.

commit 46482decd5ec7c15811e1db5f992b0f616472cfe Author: AUTOMATIC [email protected] Date: Tue Mar 21 06:49:19 2023 +0300

The most recent commit prior to this is 8e3ced73a8c8f435809de544e0574da265177289 So if you want the last known good:

git checkout 8e3ced73a8c8f435809de544e0574da265177289

For those that are interested, the error message for 46482decd5ec7c15811e1db5f992b0f616472cfe is:

Model loaded in 15.9s (create model: 0.7s, apply weights to model: 7.1s, apply half(): 1.9s, load VAE: 1.7s, move model to device: 1.2s, load textual inversion embeddings: 3.1s).
Traceback (most recent call last):
  File "E:\stable-diffusion-webui\modules\ui.py", line 460, in create_ui
    txt2img_prompt, txt2img_prompt_styles, txt2img_negative_prompt, submit, _, _, txt2img_prompt_style_apply, txt2img_save_style, txt2img_paste, extra_networks_button, token_counter, token_button, negative_token_counter, negative_token_button = create_toprow(is_img2img=False)
  File "E:\stable-diffusion-webui\modules\ui.py", line 288, in create_toprow
    prompt = gr.Textbox(label="Prompt", elem_id=f"{id_part}_prompt", show_label=False, lines=3, placeholder="Prompt (press Ctrl+Enter or Alt+Enter to generate)")
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 300, in __init__
    IOComponent.__init__(
  File "E:\stable-diffusion-webui\modules\scripts.py", line 525, in IOComponent_init
    self.elem_classes = ["gradio-" + self.get_block_name(), *(self.elem_classes or [])]
AttributeError: 'Textbox' object has no attribute 'elem_classes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\stable-diffusion-webui\launch.py", line 381, in <module>
    start()
  File "E:\stable-diffusion-webui\launch.py", line 376, in start
    webui.webui()
  File "E:\stable-diffusion-webui\webui.py", line 240, in webui
    shared.demo = modules.ui.create_ui()
  File "E:\stable-diffusion-webui\modules\ui.py", line 459, in create_ui
    with gr.Blocks(analytics_enabled=False) as txt2img_interface:
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1097, in __exit__
    self.config = self.get_config_file()
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1073, in get_config_file
    "props": utils.delete_none(block.get_config())
  File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 322, in get_config
    "type": self.type,
AttributeError: 'Textbox' object has no attribute 'type'. Did you mean: 'style'?

vannoo67 avatar Mar 27 '23 18:03 vannoo67

I have managed to identify the commit that introduced the issue.

good find!

Nicoolodion avatar Mar 27 '23 18:03 Nicoolodion

But isn't this fixed now? In the newest version I get the error "AttributeError: 'Blocks' object has no attribute 'elem_classes'"... I know it doesn't change much since both don't make it start 😅

Nicoolodion avatar Mar 27 '23 19:03 Nicoolodion

But isn't this fixed now? In the newest version I get the error "AttributeError: 'Blocks' object has no attribute 'elem_classes'"... I know it doesn't change much since both don't make it start 😅

I think its the same incompatibility, just manifesting in a slightly different place. Probably due to a slightly different order of execution in the later version.

TBH, I'm perplexed. I've looked at all of the changes in the commit ( https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/46482decd5ec7c15811e1db5f992b0f616472cfe ) and tried to manually roll them back, with no improvement.

Clearly I'm missing something.

vannoo67 avatar Mar 27 '23 19:03 vannoo67

TBH, I'm perplexed. I've looked at all of the changes in the commit ( 46482de ) and tried to manually roll them back, with no improvement.

Clearly I'm missing something.

Yeah. I did the same thing with no result. Something has happened, but I don't know what.

Nicoolodion avatar Mar 27 '23 19:03 Nicoolodion

I don't know what this page ( 46482de ) is supposed to be telling me.

Actually doing:

git diff 46482decd5ec7c15811e1db5f992b0f616472cfe 8e3ced73a8c8f435809de544e0574da265177289

showed that quite a few other files were changed as well

extensions-builtin/prompt-bracket-checker/javascript/prompt-bracket-checker.js
javascript/edit-attention.js
javascript/extraNetworks.js
javascript/hints.js
javascript/imageviewer.js
javascript/progressbar.js
javascript/ui.js
modules/images.py
modules/scripts.py
modules/scripts_postprocessing.py
modules/ui.py
modules/ui_common.py
modules/ui_components.py
modules/ui_extra_networks.py
requirements.txt
requirements_versions.txt
script.js
scripts/postprocessing_upscale.py
style.css

ui_common.py and ui_components.py look promising

Note: the change in the requirements.txt is a Gradio upgrade. Sadly rolling that back did not solve the problem

vannoo67 avatar Mar 27 '23 20:03 vannoo67

On the assumption that the problem that we are having is niche, I tried to figure out if the problem was related to an extension. With webui checkout out to last-known-good ( https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/8e3ced73a8c8f435809de544e0574da265177289 )

I disabled all of the extensions, cold-started the last-known-good. Confirmed all was ok

Moved repo to master, checked that I was up-to-date (I was) Started webui, no problems - yay.

Proceeded to enable the extensions one by one, (Enable, Restart UI, cold-start webui, refresh) I left Dreambooth until last. (I figured that if it was going to be anything, it would be Dreambooth)

After testing all of the extensions (except Dreambooth), I found updates for sd-3dmodel-loader and clip-interrogator-ext and installed them.

Holding my breath I enabled Dreambooth, then was staggered to see that webui started with no complaints. I re-enabled all of my other extensions, and it started fine.

Soooo. Everthing is working again. Not sure if it was one of A1111's recent commits or the process of disabling and re-enabling my extensions. So if you are still having trouble, try the above.

Hope this helps.

vannoo67 avatar Mar 28 '23 09:03 vannoo67

I disabled all of the extensions, cold-started the last-known-good. Confirmed all was ok

Dumb question, but how do I disaple extensions without being able to come in the webui? Do I just put them into a different folder?

Nicoolodion avatar Mar 28 '23 13:03 Nicoolodion

Ok just found out myself. I can agree with you about Dreambooth. It fixed it for me too. I now just deinstalled Dreambooth since I never really use it and it destroys everything so often... Thank you for the solution!

Nicoolodion avatar Mar 28 '23 13:03 Nicoolodion

No worries, happy to help.

vannoo67 avatar Mar 28 '23 13:03 vannoo67

This issue has popped up again in latest commit.

AttributeError: 'Blocks' object has no attribute 'elem_classes'

SilverDash avatar Apr 06 '23 22:04 SilverDash

still broken

QinCaii avatar Apr 26 '23 14:04 QinCaii

Newer versions have fixed this. Open a new issue if the problem persists as of the latest version.

catboxanon avatar Aug 06 '23 17:08 catboxanon