-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Check for attention mask in backends that don't support it #12892
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
Conversation
yiyixuxu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|
@bot /style |
|
Style bot fixed some files and pushed the changes. |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
sayakpaul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
But we don't even support passing attn_mask in the respective methods. So, I am not sure how this is applicable.
True, but that is the point: Those backends don't have an 'attn_mask' parameter currently. Therefore, when the caller passes an 'attn_mask' argument, the attention mask is silently ignored here:
if checks are disabled, which they are by default. Ignoring extra arguments might be valid behaviour for other paremters, but not for attention masks. Ignoring an attention mask yields incorrect results. It should fail instead of returning incorrect results - that's what this PR does. @yiyixuxu your style bot changed a line I didn't even mean to insert. Fixed. |
What does this PR do?
Using an attention backend (https://huggingface.co/docs/diffusers/main/optimization/attention_backends) with a model that passes attention masks yields incorrect results.
This is already checked in parallel backends...
diffusers/src/diffusers/models/attention_dispatch.py
Line 978 in f6b6a71
...but not yet in the regular ones.
This PR changes that.
Fixes #12605
Who can review?
@yiyixuxu and @asomoza
CC @zzlol63 @tolgacangoz