Add Flux2 DreamBooth prior preservation tests#13857
Open
azolotenkov wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds regression tests to ensure DreamBooth LoRA training for Flux2 (and Flux2 Klein) works with prior preservation when train_batch_size=2.
Changes:
- Added a new prior-preservation test case with
train_batch_size=2totest_dreambooth_lora_flux2.py. - Added the equivalent prior-preservation test case to
test_dreambooth_lora_flux2_klein.py.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| examples/dreambooth/test_dreambooth_lora_flux2.py | Adds a prior-preservation training test using batch size 2 and validates LoRA weights are produced. |
| examples/dreambooth/test_dreambooth_lora_flux2_klein.py | Adds the same prior-preservation batch size 2 test for the Flux2 Klein variant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+121
to
+124
| --with_prior_preservation | ||
| --class_data_dir {self.instance_data_dir} | ||
| --class_prompt dog | ||
| --num_class_images 2 |
Contributor
Author
There was a problem hiding this comment.
I updated both tests to use a dedicated temporary class_data directory and copy two fixture images into it, so the tests no longer reuse the instance data directory for class images.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds DreamBooth LoRA smoke coverage for
Flux2andFlux2 Kleinprior-preservation training withtrain_batch_size=2.This covers the prior-preservation path where the effective batch is grouped as
[instance samples..., class samples...]. The test helps guard against regressions in prompt/text embedding repetition and prior-loss splitting when the per-device train batch size is greater than 1.Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@sayakpaul