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

NPU adaption for FLUX #10465

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

NPU adaption for FLUX #10465

wants to merge 2 commits into from

Conversation

leisuzz
Copy link
Contributor

@leisuzz leisuzz commented Jan 6, 2025

What does this PR do?

Added Flash Attention for FLUX
Fixed issue in Flux Controlnet when using enable flash attention

Before submitting

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.

@leisuzz
Copy link
Contributor Author

leisuzz commented Jan 6, 2025

@sayakpaul Please take a look at this Flux adaption. Thank you!

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to the training script look good to me. Off to @yiyixuxu for the other changes.

@HuggingFaceDocBuilderDev

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.

@@ -140,7 +141,10 @@ def __init__(
self.norm1_context = AdaLayerNormZero(dim)

if hasattr(F, "scaled_dot_product_attention"):
processor = FluxAttnProcessor2_0()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep the default logic simple i.e. remove the changes from this file
you can use NPU with set_attn_processor, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yiyixuxu In the attention processor, it has NPU FA, but only with AttnProcessorNPU. Or do you want me to add a function in attention_processor.py to change the processor there? I think right now the selection is only in the init, so it shouldn't be any logic changes. Please let me know what you think so that I can modify based on that. Thanks

In the attention processor, it has NPU FA, but only with AttnProcessorNPU. Or do you want me to add a function in attention_processor.py to change the processor there? I think right now the selection is only in the init, so it shouldn't be any logic changes. Please let me know what you think so that I can modify based on that. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants