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: module 'diffusers.models.attention' has no attribute 'CrossAttention' #3182

Closed
1 task done
ghost opened this issue Apr 12, 2023 · 30 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Apr 12, 2023

Is there an existing issue for this?

  • I have searched the existing issues

OS

Windows

GPU

cuda

VRAM

24GB

What version did you experience this issue on?

2.3.4

What happened?

It was installing without problems, when it was time to run it gave that error.

Screenshots

image
image

Additional context

It happens when I try to run it.

Contact Details

No response

@ghost ghost added the bug Something isn't working label Apr 12, 2023
@elsucht
Copy link

elsucht commented Apr 12, 2023

same error message for me on a Linux System when running invokeai-configure (manual installation method)

@byebye758
Copy link

I also encountered the same error when using invokeai-configure in manual installation mode on my Mac Mini M2.

@AviDTechnion
Copy link

This seems global.
maybe they moved it to module cross_attention.py ?

@Inhalemyfart
Copy link

Got the same issue on Win10. Tried to install Invoke AI on a fresh (clean) Win11 installation, there I get the same blocking error.

@gardunorr
Copy link

Same problem !

@RogueTabletop
Copy link

I'm also having this Issue.

@igorvazz
Copy link

I solved it by downloading the Source code (zip) file, then changing the diffusers version to 0.14.0 at the pyproject.toml file, and then going to the installer folder, and generating a new installer file by running the create_installer.sh script

@reicou
Copy link

reicou commented Apr 12, 2023

same problem here

@Dragostini
Copy link

Same problem on fresh install

@BrunoBieri
Copy link

I've the same problem on fresh install on Windows 11 Pro (22H2 - 22621.1555).

@MetaverseJosh
Copy link

Same problem fresh install with fresh python 10.9 or 10.10.

@pryadchenko
Copy link

pryadchenko commented Apr 12, 2023

This is because of recent update of diffusers. Just downgrade it:
python -m pip install diffusers==0.14.0

@meandnano
Copy link

This is because of recent update of diffusers. Just downgrade it: python -m pip install diffusers==0.14.0

Did it in the invokeai's venv and it seemed to help. No issues so far.

The full fix:

. .venv/bin/activate
python -m pip install diffusers==0.14.0

@romandesign
Copy link

romandesign commented Apr 12, 2023

This is because of recent update of diffusers. Just downgrade it: python -m pip install diffusers==0.14.0

Did it in the invokeai's venv and it seemed to help. No issues so far.

The full fix:

. .venv/bin/activate
python -m pip install diffusers==0.14.0

I did it and it didn't work. Perhaps I'm not doing anything correctly, I don't understand what the first line means. Second command run OK and did bunch of things, but I still get the same error. I have deleted the old InvokeAI installation and I'm trying to install it from scratch to d:\InvokeAI\ but I get the same error.
What exactly do I run from CMD?
Note: I also got it trying to install 2.3.3

@blessedbob
Copy link

Bump, got this same error
image

@romandesign
Copy link

OK, so here's a full fix for those who like me don't know how to use Python properly.

  1. After the error occurs, run CMD and go to the installation folder into .venv\Scripts directory and run activate.bat that should be there.
  2. Then you will see the (.venv) prompt. In that prompt run python -m pip install diffusers==0.14.0 and you will see a message about version 15 uninstalled and 14 installed.
  3. Then try installing InvokeAI again and it should work. At least I got past the error point without any problem.

@SoyPro12
Copy link

SoyPro12 commented Apr 13, 2023

  1. install
  2. press any key
  3. closing installer
  4. run invoke.bat
  5. 8 - dev console
  6. pip install --upgrade --force-reinstall diffusers==0.14.0
  7. close that window
  8. run invoke.bat once again
  9. 7 re-run the configure script to fix a broken install

Credit: StAlKeR7779 on the Invoker Discord

@Bacon-Tech
Copy link

Bacon-Tech commented Apr 13, 2023

I did try to update the code to use what the deprecated warning said and that got me past this error during installation but then after trying to load the tool I ran into another error module 'os' has no attribute 'fork'.

So I just decided to do a clean install of the latest alpha and we will see how that goes.

if anyone else wants to try below is what I did.

in the cross_attention_control.py file I change line 450:

class InvokeAIDiffusersCrossAttention(diffusers.models.attention.CrossAttention, InvokeAICrossAttentionMixin):

to:

class InvokeAIDiffusersCrossAttention(diffusers.models.attention_processor.Attention, InvokeAICrossAttentionMixin):

Edit:

as others have mentioned I can confirm on my end going into command prompt and going to the scripts folder in the venv and running python -m pip install diffusers==0.14.0 fixed my problem

@xDylite
Copy link

xDylite commented Apr 13, 2023

  1. install

    1. press any key

    2. closing installer

    3. run invoke.bat

    4. 8 - dev console

    5. pip install --upgrade --force-reinstall diffusers==0.14.0

    6. close that window

    7. run invoke.bat once again

    8. 7 re-run the configure script to fix a broken install

Credit: StAlKeR7779 on the Invoker Discord

Took a couple of tries but this indeed works :D

@lstein
Copy link
Collaborator

lstein commented Apr 13, 2023

Folks, this is the result of the diffusers library making an unexpected API-breaking update. A hotfix for this is in the works and will be released later today. #3188

@lstein
Copy link
Collaborator

lstein commented Apr 13, 2023

New release to fix this issue: https://github.com/invoke-ai/InvokeAI/releases/tag/v2.3.4.post1

@Void2258
Copy link

If this has been fixed should this issue be closed?

@BrunoBieri
Copy link

Tested the new release 2.3.4.post1 on Windows 11 Pro and the installation worked for me where I previously encountered that issue.

@gardunorr
Copy link

gardunorr commented Apr 14, 2023 via email

@lstein
Copy link
Collaborator

lstein commented Apr 14, 2023 via email

@lstein lstein closed this as completed Apr 14, 2023
AbdBarho added a commit to AbdBarho/stable-diffusion-webui-docker that referenced this issue Apr 16, 2023
## Justification

Closes issue #352

This update makes the Dockerfiles OCI compliant, making it easier to use
Buildah or other image building techniques that require it

## Implementation

This changes a few things, listed below:

* auto: Download container is switched to alpine. The `git` container
specified the `/git` directory as a volume. As such, all the files under
`/git` would be lost after each script invoke. Alpine is used later in
the build process anyway, so it shouldn't be any extra cost to switch to
it
* auto: "New" clone.sh script is copied into the container, which is
basically just the previous clone script that was embedded in the
Dockerfile.
* all: `<<EOF` heredoc styles have been switched to `&& \`
* all: I added NVIDIA_DRIVER_CAPABILITIES and NVIDIA_VISIBLE_DEVICES to
expose my Nvidia card. This is most likely a selinux/podman problem, but
shouldn't change anything with docker to add it.
* docker-compose: I added selinux labeling. I tested this with real
docker (not just podman!) and it seems to work fine. Though I suggest
you try it too.

## Testing

Locally builds with buildah. 

Note: for caching to work properly, you still need to replace
`/root/.cache/pip` with `/root/.cache/pip,Z` on selinux systems.

Note: I was having some trouble running invoke. Thought it was this PR,
but it's a known issue. See
invoke-ai/InvokeAI#3182

---------

Co-authored-by: AbdBarho <ka70911@gmail.com>
@cinemapara
Copy link

On macbook m2 ventura i still get AttributeError: module 'diffusers.models.attention' has no attribute 'CrossAttention'
I tried diffusers-0.15.0 and diffusers-0.14.0
I was using https://github.com/invoke-ai/InvokeAI/releases/tag/v2.3.4.post1

@lstein lstein reopened this Apr 20, 2023
@lstein
Copy link
Collaborator

lstein commented Apr 20, 2023

On macbook m2 ventura i still get AttributeError: module 'diffusers.models.attention' has no attribute 'CrossAttention' I tried diffusers-0.15.0 and diffusers-0.14.0 I was using https://github.com/invoke-ai/InvokeAI/releases/tag/v2.3.4.post1

Could you provide the steps needed to reproduce the error?

Jordan-Lambda pushed a commit to Jordan-Lambda/lambda-cloud-stable-diffusion-2.0-webui-easy that referenced this issue Aug 2, 2023
## Justification

Closes issue AbdBarho#352

This update makes the Dockerfiles OCI compliant, making it easier to use
Buildah or other image building techniques that require it

## Implementation

This changes a few things, listed below:

* auto: Download container is switched to alpine. The `git` container
specified the `/git` directory as a volume. As such, all the files under
`/git` would be lost after each script invoke. Alpine is used later in
the build process anyway, so it shouldn't be any extra cost to switch to
it
* auto: "New" clone.sh script is copied into the container, which is
basically just the previous clone script that was embedded in the
Dockerfile.
* all: `<<EOF` heredoc styles have been switched to `&& \`
* all: I added NVIDIA_DRIVER_CAPABILITIES and NVIDIA_VISIBLE_DEVICES to
expose my Nvidia card. This is most likely a selinux/podman problem, but
shouldn't change anything with docker to add it.
* docker-compose: I added selinux labeling. I tested this with real
docker (not just podman!) and it seems to work fine. Though I suggest
you try it too.

## Testing

Locally builds with buildah. 

Note: for caching to work properly, you still need to replace
`/root/.cache/pip` with `/root/.cache/pip,Z` on selinux systems.

Note: I was having some trouble running invoke. Thought it was this PR,
but it's a known issue. See
invoke-ai/InvokeAI#3182

---------

Co-authored-by: AbdBarho <ka70911@gmail.com>
cloudaxes pushed a commit to cloudaxes/stable-diffusion-webui-docker that referenced this issue Sep 6, 2023
## Justification

Closes issue AbdBarho#352

This update makes the Dockerfiles OCI compliant, making it easier to use
Buildah or other image building techniques that require it

## Implementation

This changes a few things, listed below:

* auto: Download container is switched to alpine. The `git` container
specified the `/git` directory as a volume. As such, all the files under
`/git` would be lost after each script invoke. Alpine is used later in
the build process anyway, so it shouldn't be any extra cost to switch to
it
* auto: "New" clone.sh script is copied into the container, which is
basically just the previous clone script that was embedded in the
Dockerfile.
* all: `<<EOF` heredoc styles have been switched to `&& \`
* all: I added NVIDIA_DRIVER_CAPABILITIES and NVIDIA_VISIBLE_DEVICES to
expose my Nvidia card. This is most likely a selinux/podman problem, but
shouldn't change anything with docker to add it.
* docker-compose: I added selinux labeling. I tested this with real
docker (not just podman!) and it seems to work fine. Though I suggest
you try it too.

## Testing

Locally builds with buildah. 

Note: for caching to work properly, you still need to replace
`/root/.cache/pip` with `/root/.cache/pip,Z` on selinux systems.

Note: I was having some trouble running invoke. Thought it was this PR,
but it's a known issue. See
invoke-ai/InvokeAI#3182

---------

Co-authored-by: AbdBarho <ka70911@gmail.com>
@wangqiang9
Copy link

from diffusers.models.attention_processor import Attention

@ruofanliu0129
Copy link

Just simply try "pip install diffusers<=0.16.0", which works for me.

@JY9087
Copy link

JY9087 commented May 24, 2024

This is because of recent update of diffusers. Just downgrade it: python -m pip install diffusers==0.14.0

It works ! Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests