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

Replace einops.rearrange with torch native #2

Merged
merged 1 commit into from
May 15, 2024
Merged

Conversation

huchenlei
Copy link
Owner

Description

According to lllyasviel/stable-diffusion-webui-forge#716 (comment), einops.rearrange calls in crossattn is causing extra overhead. Replacing it with torch native ops can save ~55ms/it.

Screenshots/videos:

image

TODO

There are other places where einops.rearrange can be replaced by torch native ops, but this one in CrossAttn is the most critical one. Instrument the usage of einops.rearrange elsewhere might also yield some improvements.

Checklist:

@huchenlei huchenlei merged commit aaa8a99 into all_perf May 15, 2024
6 checks passed
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.

1 participant