Repository navigation
Conversation
Signed-off-by: Subodh Bansode <subodh171011@gmail.com>
This branch has not been deployed
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.
Description
Fixes #10722.
The Flux DreamBooth LoRA training scripts still concatenate
text_idswithclass_text_idswhen prior preservation is enabled.text_idsis now a 2D tensor containing sequence positional IDs.FluxTransformer2DModelbroadcasts this tensor internally across the batch, so concatenating instance and classtext_idsalong dimension 0 incorrectly doubles the sequence dimension.This causes a sequence-length mismatch later when the transformer constructs the rotary embeddings.
Changes
Remove the incorrect
text_idsconcatenation from the static prior-preservation path in:examples/dreambooth/train_dreambooth_lora_flux.pyexamples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.pyThe resulting
text_idsshape matches the format expected byFluxTransformer2DModeland the existing dynamic prompt path.Background
PR #9653 changed Flux
text_idsfrom a batched tensor to a 2D tensor because the transformer handles batch broadcasting internally. The prior-preservation static caching path retained the older concatenation logic.Testing
python -m py_compile examples/dreambooth/train_dreambooth_lora_flux.py examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.pyruff check examples/dreambooth/train_dreambooth_lora_flux.py examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.pygit diff --checkThe repository currently does not provide an isolated prior-preservation regression test for these training scripts, so no new end-to-end test is included in this minimal fix.
Fixes #10722