Fix the bug that joint_attention_kwargs is not passed to the FLUX's transformer attention processors#9517
Conversation
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks for the PR! I left a question
| encoder_hidden_states: torch.FloatTensor, | ||
| temb: torch.FloatTensor, | ||
| image_rotary_emb=None, | ||
| joint_attention_kwargs={}, |
There was a problem hiding this comment.
can you explain what additional argument you need to pass down to flux attention processor?
There was a problem hiding this comment.
Thank you for your recognition!
In our work, I am trying to integrate box and mask into the FLUX model and implement layout control (similar to what has been done in many works on SD1.4). This requires modifying the attention processor. I believe that the architecture of FLUX and other transformers can also be used to develop better layout control algorithms, so I believe these modifications will contribute to future training-free experiments on FLUX.
yiyixuxu
left a comment
There was a problem hiding this comment.
thanks! let's support this :)
| encoder_hidden_states: torch.FloatTensor, | ||
| temb: torch.FloatTensor, | ||
| image_rotary_emb=None, | ||
| joint_attention_kwargs={}, |
There was a problem hiding this comment.
| joint_attention_kwargs={}, | |
| joint_attention_kwargs=None, |
| norm_hidden_states, gate = self.norm(hidden_states, emb=temb) | ||
| mlp_hidden_states = self.act_mlp(self.proj_mlp(norm_hidden_states)) | ||
|
|
||
| joint_attention_kwargs = joint_attention_kwargs if joint_attention_kwargs is not None else {} |
There was a problem hiding this comment.
should we pass this to attn too?
There was a problem hiding this comment.
Yes! I think it will be useful for other trial!
fix a little bug
|
I fixed a bug and now it is okay XD. |
|
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. |
a-r-r-o-w
left a comment
There was a problem hiding this comment.
thank you, looks good! could you run make style to fix the failing quality tests.
i have a question though: in this comment, you mention that your work uses this feature to modify something in, or pass additional arguments to, the attention processor. it is understandable why this would be useful, but we generally do not add features that are not testable or usable without a public implementation. is your work/method utilizing this change available for testing this? if it will be available in the near future, i think it might be best to postpone merging this PR after that
oh, i just saw yiyi's comment about being okay with supporting this. in that case, please disregard my question above. let's fix the quality tests and we should be okay to merge |
|
@a-r-r-o-w |
Yes, that's it! QWQ |
|
@a-r-r-o-w |
|
Hi @HorizonWind2004, looks good to me! Could you run |
Yes! Now it is okay. |
|
@a-r-r-o-w @yiyixuxu |
… transformer attention processors (huggingface#9517) * Update transformer_flux.py
… transformer attention processors (#9517) * Update transformer_flux.py
Issue link is below:
#9516