-
Notifications
You must be signed in to change notification settings - Fork 6k
Support pass kwargs to sd3 custom attention processor #9818
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
Support pass kwargs to sd3 custom attention processor #9818
Conversation
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.
The PR looks good for the specific changes required to support kwargs, but all the other changes are unrelated. Please revert any changes not related supporting kwargs such as multi-line import, multi-line assigments, etc. These were not required before, nor needed now due to 120 token column limit. If these were caused by your text editor automatically, please configure it to use the same settings as pyproject.yaml for this specific repo
f2ae8a1
to
e3bed52
Compare
Thanks @a-r-r-o-w 😊, I've configured my editor and reverted all unrelated changes. Now this PR only contains necessary 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. |
Co-authored-by: hlky <[email protected]>
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.
Edit: let's add joint_attention_kwargs = joint_attention_kwargs or {}
instead like https://github.com/huggingface/diffusers/pull/9517/files
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 @Matrix53!
cc @sayakpaul @yiyixuxu WDYT about making default |
Not opposed to the idea. |
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!
Co-authored-by: YiYi Xu <[email protected]>
* Support pass kwargs to sd3 custom attention processor --------- Co-authored-by: hlky <[email protected]> Co-authored-by: YiYi Xu <[email protected]>
* Support pass kwargs to sd3 custom attention processor --------- Co-authored-by: hlky <[email protected]> Co-authored-by: YiYi Xu <[email protected]>
What does this PR do?
Fixes #8855 as #9517
As mentioned in #8855 and #9516, pass kwargs to custom attention processor is preferable when implementing layout control, attention replacing or introducing side effect to attention computation. Now this feature is supported by sd, sdxl, FLUX series, but not sd3. This PR fix the problem, and may support future training-free experiments in sd3 series models.
example code:
The documentation already describes usage of the joint_attention_kwargs:

Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
Hello @yiyixuxu @sayakpaul, I just want to do the same to sd3 as to FLUX in #9517