[lora training] fix aspect ratio bucketing in dreambooth scripts (+ caption dropout, --bucket_no_upscale)#14158
Open
linoytsaban wants to merge 2 commits into
Open
[lora training] fix aspect ratio bucketing in dreambooth scripts (+ caption dropout, --bucket_no_upscale)#14158linoytsaban wants to merge 2 commits into
linoytsaban wants to merge 2 commits into
Conversation
…--bucket_no_upscale
|
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. |
sayakpaul
reviewed
Jul 10, 2026
| loaded_lora_rank = raw["transformer.r"] | ||
| self.assertTrue(loaded_lora_rank == rank) | ||
|
|
||
| def test_dreambooth_lora_flux2_aspect_ratio_buckets(self): |
Member
There was a problem hiding this comment.
I think we can remove this test for now. Let's see if this feature becomes more and more used and then add it back. So, we could just skip it.
| self.assertTrue(all("lora" in k for k in lora_state_dict.keys())) | ||
| self.assertTrue(all(key.startswith("transformer") for key in lora_state_dict.keys())) | ||
|
|
||
| def test_dreambooth_lora_flux2_caption_dropout(self): |
Comment on lines
+453
to
+457
| parser.add_argument( | ||
| "--bucket_no_upscale", | ||
| action="store_true", | ||
| help="If set, images smaller than their aspect-ratio bucket are padded instead of upscaled.", | ||
| ) |
Member
There was a problem hiding this comment.
Does this help at all? If so, I would maybe keep it simple and just upscale. Also, should we enable bucketing through an arg?
Comment on lines
-893
to
-900
| self.image_transforms = transforms.Compose( | ||
| [ | ||
| transforms.Resize(size, interpolation=transforms.InterpolationMode.BILINEAR), | ||
| transforms.CenterCrop(size) if center_crop else transforms.RandomCrop(size), | ||
| transforms.ToTensor(), | ||
| transforms.Normalize([0.5], [0.5]), | ||
| ] | ||
| ) |
Member
There was a problem hiding this comment.
If we're going with the above suggestion i.e. make aspect-ratio bucketing conditional on an arg, then I guess this should stay?
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.
Split from #14089. Bucketing fixes for the scripts that already support aspect-ratio buckets (flux2, flux2_img2img, flux2_klein(+img2img), flux_kontext, z_image):
--bucket_no_upscale: pad images smaller than their bucket instead of upscaling