Skip to content

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

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

Closed
wants to merge 1 commit into from

Conversation

haotian-liu
Copy link

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

HuggingFaceDocBuilderDev commented Mar 22, 2023

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

@kashif
Copy link
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
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
Contributor

Hey @haotian-liu ,

I think this has been fixed with: #3200

@haotian-liu
Copy link
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