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

[Bug]: AttributeError: type object 'BasicTransformerBlock' has no attribute 'ATTENTION_MODES'

Open OccultMC opened this issue 3 years ago • 24 comments

Is there an existing issue for this?

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

What happened?

Tried to run automatic1111 and got this error below\

Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py", line 13, in from modules import shared, devices, sd_samplers, upscaler, extensions, localization File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers.py", line 11, in from modules import prompt_parser, devices, processing, images File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 15, in import modules.sd_hijack File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack.py", line 31, in ldm.modules.attention.BasicTransformerBlock.ATTENTION_MODES["softmax-xformers"] = ldm.modules.attention.CrossAttention AttributeError: type object 'BasicTransformerBlock' has no attribute 'ATTENTION_MODES'

Steps to reproduce the problem

  1. Go to thelastben colab and run the cells in sequence
  2. Press start stable-diffusion
  3. and BOOM. error

What should have happened?

To able to properly run stable diffusion

Commit where the problem happens

latest

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

set COMMANDLINE_ARGS="--enable-insecure-extension-access --hypernetwork-dir modules/hypernetworks --xformers --opt-split-attention --precision full --medvram --no-half --deepdanbooru"

Additional information, context and logs

No response

OccultMC avatar Nov 27 '22 08:11 OccultMC

It happens in webui after recent update.

syproduction avatar Nov 27 '22 09:11 syproduction

Same here.

dinmakers avatar Nov 27 '22 11:11 dinmakers

Same:/

JotaVera avatar Nov 27 '22 13:11 JotaVera

Yes, is the attention.py file in the ldm/modules folder that is not working anymore. I'm using AUTOMATIC1111 in local so i just used the ldm folder of the original repo and deleted the older one. I think you can just do that in your gdrive or wait for an update by TheLastBen

Nuked88 avatar Nov 27 '22 13:11 Nuked88

FYI; happening after 755df94b2aa62eabd96f900e0dd7ddc83c2f692c. I just checked out backwards until I found a commit that worked. For the git newbs, run git checkout 755df94b2aa62eabd96f900e0dd7ddc83c2f692c until a fix gets merged.

BTW Automatic, you should have a patreon/crypto donate box :) Thanks for your hard work

yacineMTB avatar Nov 27 '22 13:11 yacineMTB

Seems this is a python module lib path problem. Python is using your old SD1.0 repository when it actually should be using the newer version.

To check, do a 'python3 -m site', you will find 'yourpath/repositories/stable-diffusion' before 'your_path/repositories/stable-diffusion-stability-ai' where the right module should be.

To fix it, vi ~/stable-diffusion-webui/venv/lib/python3.9/site-packages/easy-install.pth

delete this line and save

your_path/repositories/stable-diffusion/

Worked for me.

ebziw avatar Nov 27 '22 16:11 ebziw

glad im not the only one. unfortunately I don't understand code so i'll just have to wait for it to be updated.

FallwoodAI avatar Nov 27 '22 22:11 FallwoodAI

mee too in the same situation, i'm waiting the fix :/

hanku89 avatar Nov 27 '22 23:11 hanku89

Yes, is the attention.py file in the ldm/modules folder that is not working anymore. I'm using AUTOMATIC1111 in local so i just used the ldm folder of the original repo and deleted the older one. I think you can just do that in your gdrive or wait for an update by TheLastBen

Thank you! Technical or not, this is the easiest way to fix it for now. Confirms that it works if you are using google colab and locally it might be similar.

dimitriharding avatar Nov 27 '22 23:11 dimitriharding

Seems this is a python module lib path problem. Python is using your old SD1.0 repository when it actually should be using the newer version.

To check, do a 'python3 -m site', you will find 'yourpath/repositories/stable-diffusion' before 'your_path/repositories/stable-diffusion-stability-ai' where the right module should be.

To fix it, vi ~/stable-diffusion-webui/venv/lib/python3.9/site-packages/easy-install.pth

delete this line and save

your_path/repositories/stable-diffusion/

Worked for me.

also work for me.

myhz0606 avatar Nov 28 '22 02:11 myhz0606

Just remove older stable-diffusion and reinstall it. The version changed.

xzymustbexzy avatar Nov 28 '22 06:11 xzymustbexzy

Yes, is the attention.py file in the ldm/modules folder that is not working anymore. I'm using AUTOMATIC1111 in local so i just used the ldm folder of the original repo and deleted the older one. I think you can just do that in your gdrive or wait for an update by TheLastBen

Thank you! Technical or not, this is the easiest way to fix it for now. Confirms that it works if you are using google colab and locally it might be similar. šŸ‘

Nuked88 avatar Nov 28 '22 21:11 Nuked88

No tricks worked for me using Google Colab... I still see the same issue...

Liques avatar Nov 29 '22 11:11 Liques

No tricks worked for me using Google Colab... I still see the same issue...

add somewhere this before running the last cell: !curl -L --create-dirs https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/ldm/modules/attention.py -o /content/stable-diffusion-webui/ldm/modules/attention.py

imacopypaster avatar Nov 29 '22 11:11 imacopypaster

This half worked for me. Once I’d worked out which LDM folder to replace. Mine was in:

/Users/andy/Documents/stable-diffusion-webui/repositories/stable-diffusion-stability-ai

Renamed it and put the suggested folder in its place and although I did get

No module 'xformers'. Proceeding without it

I got the v2 model loaded. However when running v2 from the web ui it fails with:

AttributeError: module 'k_diffusion.external' has no attribute 'CompVisVDenoiser'

Works as before with the 1.5 models.

Andy

On 28 Nov 2022, at 21:00, Nuked @.***> wrote:

Yes, is the attention.py file in the ldm/modules folder that is not working anymore. I'm using AUTOMATIC1111 in local so i just used the ldm folder of the original repo https://github.com/Stability-AI/stablediffusionand deleted the older one. I think you can just do that in your gdrive or wait for an update by TheLastBen https://github.com/TheLastBen Thank you! Technical or not, this is the easiest way to fix it for now. Confirms that it works if you are using google colab and locally it might be similar. šŸ‘

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5101#issuecomment-1329754821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3OXLXKN73HS7NS56PBLHTWKUMPHANCNFSM6AAAAAASMMSYFI. You are receiving this because you commented.

dinmakers avatar Nov 29 '22 12:11 dinmakers

UPDATE Apparently not all samplers are supported. I have v2 working in the web ui using DDIM.

On 29 Nov 2022, at 12:22, @.*** wrote:

This half worked for me. Once I’d worked out which LDM folder to replace. Mine was in:

/Users/andy/Documents/stable-diffusion-webui/repositories/stable-diffusion-stability-ai

Renamed it and put the suggested folder in its place and although I did get

No module 'xformers'. Proceeding without it

I got the v2 model loaded. However when running v2 from the web ui it fails with:

AttributeError: module 'k_diffusion.external' has no attribute 'CompVisVDenoiser'

Works as before with the 1.5 models.

Andy

On 28 Nov 2022, at 21:00, Nuked @.***> wrote:

Yes, is the attention.py file in the ldm/modules folder that is not working anymore. I'm using AUTOMATIC1111 in local so i just used the ldm folder of the original repo https://github.com/Stability-AI/stablediffusionand deleted the older one. I think you can just do that in your gdrive or wait for an update by TheLastBen https://github.com/TheLastBen Thank you! Technical or not, this is the easiest way to fix it for now. Confirms that it works if you are using google colab and locally it might be similar. šŸ‘

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5101#issuecomment-1329754821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3OXLXKN73HS7NS56PBLHTWKUMPHANCNFSM6AAAAAASMMSYFI. You are receiving this because you commented.

dinmakers avatar Nov 29 '22 13:11 dinmakers

The V1.5 is also worked as expected after latest merge request

romellfudi avatar Nov 29 '22 17:11 romellfudi

The latest version is working fine for me, thank you all! :)

Liques avatar Nov 29 '22 23:11 Liques

If you are working in collab, just delete the sd folder in your drive and re-download all the files that solves the problem

marbit avatar Nov 30 '22 05:11 marbit

i have the colab fast diffusion and i tried like every method in this threat

rewixx avatar Nov 30 '22 16:11 rewixx

git newbs, run git checkout 755df94b2aa62eabd96f900e0dd7ddc83c2f692c until a fix gets merged. thanks, working , quick question, how once issue is fixed, how can i newbie place head to latest? git pull is enough?? thanks again

lalamax3d avatar Dec 01 '22 20:12 lalamax3d

If you are working in collab, just delete the sd folder in your drive and re-download all the files that solves the problem

This worked for me!

patrickkool avatar Dec 04 '22 08:12 patrickkool

@lalamax3d try asking chatGPT :)

yacineMTB avatar Dec 06 '22 03:12 yacineMTB

chatGPT said: This error indicates that there is no attribute called ATTENTION_MODES defined in your program. Please check if the definition of this attribute is correct and make sure that there is no spelling error.

theskywilldawn avatar Dec 11 '22 10:12 theskywilldawn

If you are working in collab, just delete the sd folder in your drive and re-download all the files that solves the problem

That works for me, thanks.

marco1210tc avatar Feb 02 '23 18:02 marco1210tc