Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AttributeError: config #11642

Closed
1 task done
Marvel0us7 opened this issue Jul 5, 2023 · 11 comments
Closed
1 task done

[Bug]: AttributeError: config #11642

Marvel0us7 opened this issue Jul 5, 2023 · 11 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@Marvel0us7
Copy link

Marvel0us7 commented Jul 5, 2023

Is there an existing issue for this?

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

What happened?

Hello,

I did a fresh install of stable-diffusion-webui on Arch Linux and got the following error during startup:

File "/home/omgwtfbbq/stable-diffusion-webui/venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 193, in getattr
raise AttributeError(item)
AttributeError: config

And crash

Steps to reproduce the problem

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip wheel
deactivate
Use fixed start script for Arch:

#!/usr/bin/env bash
source venv/bin/activate
export HSA_OVERRIDE_GFX_VERSION=10.3.0
export MIOPEN_DEBUG_COMGR_HIP_PCH_ENFORCE=0
export PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.9,max_split_size_mb:512
export PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.9,max_split_size_mb:512
export TORCH_COMMAND='pip install --pre fastapi torch torchvision --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.5'
export REQS_FILE='requirements.txt'
export LD_PRELOAD=/usr/lib/libtcmalloc.so
python launch.py --listen --opt-sub-quad-attention --disable-nan-check

Fix ModuleNotFoundError: No module named 'pytorch_lightning.utilities.distributed' with solution from #11458

Start and get the error.

What should have happened?

Normal start, zero errors, only xformers warning

Version or Commit where the problem happens

1.4

What Python version are you running on ?

Python 3.11.x (above, no supported yet)

What platforms do you use to access the UI ?

Linux

What device are you running WebUI on?

AMD GPUs (RX 6000 above)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--listen --opt-sub-quad-attention --disable-nan-check

List of extensions

None

Console logs

Python 3.11.3 (main, Jun  5 2023, 09:32:32) [GCC 13.1.1 20230429]
Version: v1.4.0
Commit hash: 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8
Installing requirements
Launching Web UI with arguments: --listen --opt-sub-quad-attention --disable-nan-check
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /home/omgwtfbbq/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Traceback (most recent call last):
  File "/home/omgwtfbbq/stable-diffusion-webui/launch.py", line 38, in <module>
    main()
  File "/home/omgwtfbbq/stable-diffusion-webui/launch.py", line 34, in main
    start()
  File "/home/omgwtfbbq/stable-diffusion-webui/modules/launch_utils.py", line 344, in start
    webui.webui()
  File "/home/omgwtfbbq/stable-diffusion-webui/webui.py", line 382, in webui
    shared.demo = modules.ui.create_ui()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/omgwtfbbq/stable-diffusion-webui/modules/ui.py", line 505, in create_ui
    modules.scripts.scripts_txt2img.setup_ui_for_section(category)
  File "/home/omgwtfbbq/stable-diffusion-webui/modules/scripts.py", line 388, in setup_ui_for_section
    self.create_script_ui(script)
  File "/home/omgwtfbbq/stable-diffusion-webui/modules/scripts.py", line 338, in create_script_ui
    import modules.api.models as api_models
  File "/home/omgwtfbbq/stable-diffusion-webui/modules/api/models.py", line 111, in <module>
    ).generate_model()
      ^^^^^^^^^^^^^^^^
  File "/home/omgwtfbbq/stable-diffusion-webui/modules/api/models.py", line 96, in generate_model
    DynamicModel.__config__.allow_population_by_field_name = True
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/omgwtfbbq/stable-diffusion-webui/venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 193, in __getattr__
    raise AttributeError(item)
AttributeError: __config__
Creating model from config: /home/omgwtfbbq/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: sub-quadratic... done.
Textual inversion embeddings loaded(0): 
Model loaded in 1.8s (load weights from disk: 0.1s, create model: 0.3s, apply weights to model: 0.6s, apply half(): 0.3s, move model to device: 0.2s, calculate empty prompt: 0.1s).

Additional information

I had it running like this for little less than a month now. I created a working venv on June 13th when first torch+ROCm nightly was built. At that point there was no ModuleNotFoundError: No module named 'pytorch_lightning.utilities.distributed' with solution and no i_n getattr raise AttributeError(item) AttributeError: config_
Now a complete fresh install doesn't work anymore.

@Marvel0us7 Marvel0us7 added the bug-report Report of a bug, yet to be confirmed label Jul 5, 2023
@Marvel0us7
Copy link
Author

Marvel0us7 commented Jul 6, 2023

Having a look at official documentation can help.

Change

export TORCH_COMMAND='pip install --pre fastapi torch torchvision --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.5'

to

export TORCH_COMMAND='pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.6'

Issue is fixed with this.

@EngsShi
Copy link

EngsShi commented Jul 10, 2023

I have same problem.
I found that pydantic upgraded to version 2.0, but when I downgraded pydantic to 1.10.11, it started working.

running stable-diffusion-webui 1.3.2

@wezside
Copy link

wezside commented Jul 10, 2023

@EngsShi Are you running yours using a Docker container? If so which image version? I'm running 1.3.2 and updates made pydantic===1.10.11 (fixes the AttributeError) and also torchmetrics===0.11.4 for another error. Everything runs until Applying optimization: Doggettx... done. then I get a segfault.

@ashmuse
Copy link

ashmuse commented Jul 15, 2023

@EngsShi Are you running yours using a Docker container? If so which image version? I'm running 1.3.2 and updates made pydantic===1.10.11 (fixes the AttributeError) and also torchmetrics===0.11.4 for another error. Everything runs until Applying optimization: Doggettx... done. then I get a segfault.

Hey @wezside , did you found the solution?

@wezside
Copy link

wezside commented Jul 17, 2023

@ashmuse No not yet. Using this guide to try and see if I can't re-build everything. but TBH I'm seriously considering switching to Nvidia as my RX480 appears to be just too outdated even though it's my daily driver.

@zebra3141592
Copy link

I upgrated fastapi for another error and then got the same error.Finally, I fixed it by "pip install --upgrade fastapi==0.90.1".

@olivierlacan
Copy link
Contributor

Confirming the fix with the fastapi manual upgrade for Python 3.10 as well:

Before:

Python 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0]
Version: v1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Launching Web UI with arguments:
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /workspace/sd/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Traceback (most recent call last):
  File "/workspace/sd/launch.py", line 39, in <module>
    main()
  File "/workspace/sd/launch.py", line 35, in main
    start()
  File "/workspace/sd/modules/launch_utils.py", line 394, in start
    webui.webui()
  File "/workspace/sd/webui.py", line 393, in webui
    shared.demo = modules.ui.create_ui()
  File "/workspace/sd/modules/ui.py", line 504, in create_ui
    modules.scripts.scripts_txt2img.setup_ui_for_section(category)
  File "/workspace/sd/modules/scripts.py", line 433, in setup_ui_for_section
    self.create_script_ui(script)
  File "/workspace/sd/modules/scripts.py", line 383, in create_script_ui
    import modules.api.models as api_models
  File "/workspace/sd/modules/api/models.py", line 112, in <module>
    ).generate_model()
  File "/workspace/sd/modules/api/models.py", line 97, in generate_model
    DynamicModel.__config__.allow_population_by_field_name = True
  File "/root/env/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 205, in __getattr__
    raise AttributeError(item)
AttributeError: __config__
Creating model from config: /workspace/sd/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: Doggettx... done.
Model loaded in 2.6s (load weights from disk: 0.3s, create model: 0.6s, apply weights to model: 0.6s, apply half(): 0.7s, move model to device: 0.3s).

After:

Python 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0]
Version: v1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Launching Web UI with arguments:
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Loading weights [6ce0161689] from /workspace/sd/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 8.5s (launcher: 2.0s, import torch: 2.8s, import gradio: 0.8s, setup paths: 0.8s, other imports: 0.6s, load scripts: 0.5s, create ui: 0.6s, gradio launch: 0.2s).
Creating model from config: /workspace/sd/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying attention optimization: Doggettx... done.
Model loaded in 3.1s (load weights from disk: 1.0s, create model: 0.5s, apply weights to model: 0.5s, apply half(): 0.7s, move model to device: 0.3s).

olivierlacan added a commit to olivierlacan/stable-diffusion-webui that referenced this issue Aug 7, 2023
See AUTOMATIC1111#11642 (comment)

This resolves a crashing bug for me on Python 3.10 and it appears to do so
as well for others.
olivierlacan added a commit to olivierlacan/stable-diffusion-webui that referenced this issue Aug 7, 2023
See AUTOMATIC1111#11642 (comment)

This resolves a crashing bug for me on Python 3.10 and it appears to do so
as well for others.
@Marvel0us7
Copy link
Author

Just remove fastapi from TORCH_COMMAND

@olivierlacan
Copy link
Contributor

olivierlacan commented Aug 7, 2023

@Marvel0us7 Why is that a solution? I don't see fastapi listed in either webui-user.sh or webui.sh. I guess they could be pinned there but if this breaks installs by default (on Ubuntu in my case), this should be pinned at the repo level, not based on a user preference.

@Marvel0us7
Copy link
Author

My error comes from installing torch with the wrong command. I guess when installing torch in the venv with fastapi, an unsupported version of fastapi and it's requirements gets installed.

FastAPI is required by gradio and that is pinned to 3.32.0 in requirements.txt

@MetallicPickaxe
Copy link

pydantic 2.0 branch provides breaking changes from 1.0 branch, and fix its branch is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

7 participants