Skip to content

Use native memory efficient attention in PyTorch 2.0 if possible#2778

Closed
haotian-liu wants to merge 1 commit intohuggingface:mainfrom
haotian-liu:patch-1
Closed

Use native memory efficient attention in PyTorch 2.0 if possible#2778
haotian-liu wants to merge 1 commit intohuggingface:mainfrom
haotian-liu:patch-1

Conversation

@haotian-liu
Copy link
Copy Markdown

When users use PyTorch 2.0, and do not explicit enable memory efficient attention with xformers, this can potentially lead to OOM issues (while the user may believe that the efficient attention is automatically enabled with PyTorch 2.0).

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

HuggingFaceDocBuilderDev commented Mar 22, 2023

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

@kashif
Copy link
Copy Markdown
Contributor

kashif commented Mar 22, 2023

@haotian-liu this class is to be deprecated and in fact, the PR to remove it is #2697

The attention_processor.Attention class is the recommended way which selects the appropriate Pytorch 2.0 processor if it is found:

https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py#L109

@github-actions
Copy link
Copy Markdown
Contributor

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Apr 21, 2023
@patrickvonplaten
Copy link
Copy Markdown
Contributor

Hey @haotian-liu ,

I think this has been fixed with: #3200

@haotian-liu
Copy link
Copy Markdown
Author

Great, thank you! Closing this as fixed in #3200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Issues that haven't received updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants