Skip to content

diffusionmodules.make_attn: fall back to vanilla if xformers is not available #51

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

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

akx
Copy link
Contributor

@akx akx commented Jul 19, 2023

The default YAML file for SDXL specifies vanilla-xformers, which won't work if xformers is not available. This adds fallback logic like that in

if attn_mode != "softmax" and not XFORMERS_IS_AVAILABLE:
print(
f"Attention mode '{attn_mode}' is not available. Falling back to native attention. "
f"This is not a problem in Pytorch >= 2.0. FYI, you are running with PyTorch version {torch.__version__}"
)
attn_mode = "softmax"

@akx
Copy link
Contributor Author

akx commented Jul 25, 2023

@benjaminaubin For what it's worth, I tested that this works on my mac (in a future branch that stacks this, #49, and other things so using mps is possible).

@benjaminaubin
Copy link
Contributor

@benjaminaubin For what it's worth, I tested that this works on my mac (in a future branch that stacks this, #49, and other things so using mps is possible).

Yes my bad your condition is valid if you use torch >= 2.0

@benjaminaubin
Copy link
Contributor

@akx please resolve conflicts with the previous merged branch

@akx akx force-pushed the diffusion-attn-fallback branch from a8f54a1 to 60a5b25 Compare July 25, 2023 14:01
@akx
Copy link
Contributor Author

akx commented Jul 25, 2023

@benjaminaubin rebased

@benjaminaubin benjaminaubin merged commit ef520df into Stability-AI:main Jul 25, 2023
@akx akx deleted the diffusion-attn-fallback branch July 25, 2023 14:25
timudk added a commit that referenced this pull request Jul 25, 2023
jenuk pushed a commit that referenced this pull request Jul 26, 2023
akx added a commit to akx/generative-models that referenced this pull request Jul 27, 2023
akx added a commit to akx/generative-models that referenced this pull request Jul 27, 2023
akx added a commit to akx/generative-models that referenced this pull request Sep 26, 2023
akx added a commit to akx/generative-models that referenced this pull request Nov 22, 2023
akx added a commit to akx/generative-models that referenced this pull request Nov 24, 2023
LinearFalcon pushed a commit to LinearFalcon/generative-models that referenced this pull request Jul 6, 2024
LinearFalcon pushed a commit to LinearFalcon/generative-models that referenced this pull request Jul 6, 2024
SevanBrodjian pushed a commit to SevanBrodjian/sd-latent-exploration that referenced this pull request Aug 12, 2024
SevanBrodjian pushed a commit to SevanBrodjian/sd-latent-exploration that referenced this pull request Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants