Skip to content

[lora training] add caption dropout and aspect ratio buckets#14089

Open
linoytsaban wants to merge 5 commits into
mainfrom
lora-caption-dropout-ar-buckets
Open

[lora training] add caption dropout and aspect ratio buckets#14089
linoytsaban wants to merge 5 commits into
mainfrom
lora-caption-dropout-ar-buckets

Conversation

@linoytsaban

@linoytsaban linoytsaban commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Adds aspect ratio bucket support to krea 2 and qwen image (aligned with bucketing that already exists flux 2) + bucketing fix and caption dropout support.

  • Caption dropout (--caption_dropout): randomly replace an instance caption with "" so that fraction trains unconditionally (improves CFG). Added to krea2, qwen-image, flux2-klein.
  • Aspect-ratio bucketing for krea2 and qwen-image.
  • Bucketing fix: resize-to-cover then crop, instead of resizing to the exact bucket dimensions (which distorted images and made the crop a no-op). Applied across all bucketing scripts.
  • Fix 2: class/prior-preservation images are bucketed too (were forced to a fixed square).
  • --bucket_no_upscale: pad images smaller than their bucket instead of upscaling them.

@github-actions github-actions Bot added examples size/L PR with diff > 200 LOC labels Jun 29, 2026
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWYYQwMQo8A2HPBFD1qYoi
@linoytsaban linoytsaban force-pushed the lora-caption-dropout-ar-buckets branch from a539d74 to 975986d Compare June 30, 2026 09:09
linoytsaban and others added 4 commits June 30, 2026 09:23
Resize to cover the bucket then crop, instead of resizing to the exact bucket
dimensions (which distorted images and made the crop a no-op).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWYYQwMQo8A2HPBFD1qYoi
Apply the bucket-aware resize/crop to prior-preservation class images too (so
they share the instance image's bucket), and add --bucket_no_upscale to pad
images smaller than their bucket instead of upscaling them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWYYQwMQo8A2HPBFD1qYoi
Add qwen-image and flux2-klein example tests covering --aspect_ratio_buckets
(+ --bucket_no_upscale) and --caption_dropout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YWYYQwMQo8A2HPBFD1qYoi
@linoytsaban

Copy link
Copy Markdown
Collaborator Author

krea comparison with and without buckets and dropout
image

@linoytsaban linoytsaban marked this pull request as ready for review June 30, 2026 11:56
@linoytsaban linoytsaban requested a review from sayakpaul June 30, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples size/L PR with diff > 200 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants