Skip to content

Conversation

@patrickvonplaten
Copy link
Contributor

No description provided.

# 3. Feed-forward
self.norm3 = nn.LayerNorm(dim)

# if xformers is installed try to use memory_efficient_attention by default
Copy link
Contributor Author

@patrickvonplaten patrickvonplaten Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not automatically enable xformers for three reasons:

    1. It's not PyTorch-like API. PyTorch doesn't by default enable all the fastest options available
    1. We allocate GPU memory before the user even does .to("cuda")
    1. This behavior is not consistent with cases where xformers is not installed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related issues: #1565
#1344 (comment)

Copy link
Member

@anton-l anton-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very much agree with the reasoning, thanks for the update!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Dec 9, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten patrickvonplaten merged commit 6b68afd into main Dec 9, 2022
@anton-l anton-l deleted the remove_automatic_xformers branch December 9, 2022 17:29
anton-l pushed a commit that referenced this pull request Dec 9, 2022
* do not automatically enable xformers

* uP
tcapelle pushed a commit to tcapelle/diffusers that referenced this pull request Dec 12, 2022
* do not automatically enable xformers

* uP
sliard pushed a commit to sliard/diffusers that referenced this pull request Dec 21, 2022
* do not automatically enable xformers

* uP
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* do not automatically enable xformers

* uP
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.

4 participants