Repository navigation
Studio: random flip opt-in, plus checkpoint retention, caption dropout, LoRA dropout and timestep shift on the image Train tab - #13210
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
pre-commit.ci run |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 816a99ed50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| flow_shift: | ||
| isDiT && flowShiftMode !== "default" | ||
| ? flowShiftMode === "auto" | ||
| ? "auto" | ||
| : flowShift |
There was a problem hiding this comment.
Avoid compounding custom shifts on static schedulers
When a user selects Custom for FLUX, Z-Image, or Krea 2, this sends the entered value even though those pretrained schedulers already bake a static shift into scheduler.sigmas. _training_sigma_table then applies the numeric transform to that already-shifted table, so selecting 3 for a FLUX shift-3 scheduler produces an effective shift of 9 rather than the direct shift of 3 advertised by the UI, materially changing the training timestep distribution. Gate this option to unshifted/dynamic schedulers or convert the requested absolute shift before applying it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: FLUX.1, FLUX.2 and Krea 2 ship schedulers with use_dynamic_shifting (Krea's shift is 1.0), so diffusers never bakes a static shift into their sigmas and a custom value is applied once. Only Z-Image bakes one in (3 / 6), and #13215 makes a number the effective shift on the unshifted schedule there; this PR's description asks for #13215 to merge first.
| // Everything else is a DiT family. | ||
| const isDiT = familyName !== "sdxl"; | ||
| const isH3 = familyName === "minimax-h3"; | ||
| const supportsCfgDropout = isDiT && !isH3; |
There was a problem hiding this comment.
Hide caption dropout for guidance-distilled FLUX families
For flux.1, flux.2-klein, and flux.2-dev, this predicate enables Caption dropout even though the family registry marks their pipelines as ignoring negative prompts and their training forwards use only a fixed distilled-guidance vector rather than an unconditional CFG branch. A nonzero value therefore spends that fraction of an expensive run training empty captions that Studio inference never evaluates, contrary to the control's claim that it improves CFG response and potentially weakening prompt conditioning. Derive this capability per family and exclude guidance-distilled/no-negative-prompt families as well as MiniMax-H3.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: caption dropout is standard for guidance-distilled FLUX LoRAs too (ostris/ai-toolkit's FLUX example config sets caption_dropout_rate: 0.05). It keeps the LoRA from depending on the exact caption; it defaults to 0, so nothing changes unless a user sets it.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 816a99ed50
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| </div> | ||
| )} | ||
| {supportsCfgDropout && | ||
| numberField("Caption dropout", cfgDropout, setCfgDropout, 0, { |
There was a problem hiding this comment.
Keep auxiliary edits from freezing family defaults
When a user edits Caption dropout—and likewise the new LoRA dropout or custom Shift value—this call goes through numberField, whose default handler sets the shared settingsDirty flag. A later model-family change therefore skips reseeding the family-specific learning rate, rank, and resolution even though none of those fields was edited; for example, changing dropout under Qwen-Image and then selecting Krea 2 retains Qwen's 5e-5 LR/rank 16 instead of Krea's 3e-4/rank 32 defaults, which can materially alter the experiment. Give these unrelated controls their own dirty handling rather than marking the family-default fields dirty.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 039689d: Keep checkpoints, Caption dropout, LoRA dropout and the shift value pass their own no-op dirty handler, so editing them no longer stops a family switch from reseeding rank, LR and resolution.
| </SelectTrigger> | ||
| <SelectContent> | ||
| <SelectItem value="default">Default</SelectItem> | ||
| <SelectItem value="auto">Auto (match generation)</SelectItem> |
There was a problem hiding this comment.
Compute Auto shift from the selected resolution
When Auto is selected for FLUX.1 at a resolution below its maximum sequence length (including the panel's 512px family default), this option does not actually match generation: _training_sigma_table always calls time_shift with scheduler.config.max_shift, while the FLUX inference schedule derives mu from the image token count between base_shift and max_shift. At 512px this trains against the max-resolution distribution rather than the 512px generation distribution advertised by this label; either calculate Auto from the configured training resolution or restrict it to families whose shift is resolution-independent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 039689d: the Auto option is gone. It is resolution-independent only for Qwen-Image and LTX-2, which already default to it, so the control is now Default / Custom.
| random_flip: bool = Field( | ||
| False, description = "Randomly mirror training images left-right (augmentation)" |
There was a problem hiding this comment.
Preserve the legacy flip default when resuming old checkpoints
When an API client resumes a checkpoint whose manifest predates the random_flip identity field and omits random_flip again, this new request default resolves to off even though that checkpoint was created under the former on-by-default behavior. Because random_flip is optional in CheckpointIdentity.mismatch_reason, the missing legacy value skips the compatibility check, so the trainer restores optimizer/RNG state and silently changes the input stream halfway through the run. Interpret a missing legacy identity as the historical on value, or reject such resumes unless the caller supplies the original setting.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this: Studio's resume replays the run's stored config, which records random_flip explicitly (old runs stored True), so a resumed run keeps its flip setting. It takes a hand-built API resume that also omits the field to hit this.
| numberField("Shift value", flowShift, setFlowShift, 3, { | ||
| min: 0.1, | ||
| step: 0.5, | ||
| hint: "1 is no shift; around 3 suits most image models.", |
There was a problem hiding this comment.
Special-case MiniMax-H3's video-only custom shift
When MiniMax-H3 is selected, choosing Custom exposes the same value and hint as image families, but the H3 loop applies cfg.flow_shift only to sigma_video while keeping sigma_audio fixed at 3.0. The initial custom value of 3 also replaces H3's released video shift of 12, and the claim that 1 means “no shift” is false for the still-shifted audio schedule. This can unintentionally move H3 onto a substantially different coupled noise distribution; hide Custom for H3 or label it as video-only and initialize it to the H3 video default.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 039689d: the shift control is hidden for MiniMax-H3, which keeps its released video / audio shifts.
… only Default / Custom shift, not for MiniMax-H3
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Refs #10590 (every setting from that request: random flip, checkpoint retention, caption dropout, LoRA dropout and timestep shift)
Image LoRA training in Studio mirrored about half of every training image left-right by default, and the Train tab had no way to turn it off. That teaches the model both orientations of anything one-sided: text and logos come out mirrored, and a character's side parting, scar or tattoo lands on either side.
The default came from the diffusers SDXL example commands, which pass
--random_flip. In the script itself the flag is opt-in, and it is off by default in every other trainer:--random_flip, opt-in)flip_aug)flip_x)enable_random_flip)What changed
random_flipdefaults to off in the API request model and the trainer config.save_total_limit, which was fixed at 2, so earlier steps can be kept for comparison (0 keeps every one).cfg_dropout, the chance a sample trains on the empty prompt) is exposed for the DiT families. It stays hidden for SDXL, whose loop does not read it, and for MiniMax-H3, which refuses it.lora_dropout, PEFT dropout on the LoRA input) is exposed for every family; all three trainers read it. 0 by default, as before.flow_shift) is a Default / Custom select (plus a value when Custom) for the flow-matching image families; SDXL has no flow shift, and MiniMax-H3 keeps its released video / audio shifts (a number would move only its video schedule). Default sends nothing, so each family keeps its current default (Auto for Qwen-Image and LTX-2, the model's own schedule otherwise). With Studio: diffusion flow_shift is the effective shift, and min-SNR is recorded as unused for flow-matching runs #13215 a custom value is the effective shift; merge that first so a Z-Image custom value is not applied on top of its built-in shift.What did not change
random_flipexplicitly, so existing runs resume with the value they started with. A changed value is still refused by the checkpoint identity check.random_flipto off.Tests
test_random_flip_is_opt_in: the request and config default to off, an untouched request plans no flipped cache variant, andrandom_flip=Trueis still accepted.test_the_identity_covers_the_input_streamnow toggles flip on (the non-default value) and checks both on and off are recorded.tests/test_diffusion_*.py+tests/test_video_*.py, merge base vs this branch: 41 failures on both sides (compat preflight, nvfp4, one backend test; environment), none only on this branch.tsc --noEmitclean,npm test11155/11155,tests/studio/test_diffusion_train_settings_layout_contract.pypasses; eslint on the panel reports the same 7 pre-existing problems as main.Screenshots
Before (merge base) vs after (this PR), from two separate Studio installs.
Image Train tab, Z-Image selected, "Checkpoint every" set to 50. After: Keep checkpoints (2), Random flip (Off), Caption dropout (0), LoRA dropout (0) and Timestep shift (Default) appear; before has none of them.