-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add train flux2 series lora config #13011
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
base: main
Are you sure you want to change the base?
Conversation
|
@sayakpaul Please take a look at this PR. Thank you for your help! |
|
@linoytsaban Please take a look at this PR. Thank you for your help! |
|
@tcaimm thanks for this! |
|
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. |
linoytsaban
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.
LGTM!
|
@linoytsaban I've added the requested comments and included LoRA configuration support in the img2img script. Please take a look at this PR. Thank you for your help! |
What does this PR do?
Expand LoRA support for FLUX.2 series single stream blocks and update docs
1. Architectural Evolution
Compared to the original FLUX framework, the FLUX.2 architecture has undergone significant changes. Firstly, the number of single-stream layers is far greater than that of double-stream layers. Furthermore, In the Single transformer Blocks, the q,k,v projections are fused with the MLP into a single unified linear layer:
attn.to_qkv_mlp_proj.Therefore, using Flux's Lora configuration to train Flux2 is insufficient.
2. Implementation Updates
To address these changes, I have updated the LoRA configuration in the following training scripts and added additional notes to the readme:
examples/dreambooth/README_flux2.mdexamples/dreambooth/train_dreambooth_lora_flux2.pyexamples/dreambooth/train_dreambooth_lora_flux2_klein.pyThe
target_moduleslogic has been modified to ensure that the Lora adapter can correctly train the main attention layers of both double-stream and single-stream layers.Flux2 has 48 single-stream layers, while Klein has 24.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.