Repository navigation
Description
FAMILY_TRAIN_DEFAULTS recommends lr_warmup_steps: 20 for four diffusion families, and the default lr_scheduler is "constant", which diffusers.optimization.get_scheduler builds without ever reading num_warmup_steps. The advertised ramp never happens.
Affected
studio/backend/core/training/diffusion_train_common.py, FAMILY_TRAIN_DEFAULTS: flux.1, qwen-image, flux.2-klein, flux.2-dev. z-image, krea-2 and sdxl set no warmup and are unaffected.
The comment above the table states the intent plainly:
Warmup defaults: a short LR ramp keeps the first adapter updates from overshooting on the big flow-matching DiTs.
Evidence
DiffusionLoraConfig.lr_scheduler defaults to "constant" (same file, line 540). Building a config the way an API client would, straight from what /training/diffusion/info advertises:
=== what /training/diffusion/info advertises as `defaults` ===
flux.1 {'lora_rank': 16, 'learning_rate': 0.0001, 'resolution': 512, 'lr_warmup_steps': 20}
flux.2-klein {'lora_rank': 16, 'learning_rate': 0.0001, 'resolution': 512, 'lr_warmup_steps': 20}
flux.2-dev {'lora_rank': 16, 'learning_rate': 0.0001, 'resolution': 512, 'lr_warmup_steps': 20}
qwen-image {'lora_rank': 16, 'learning_rate': 5e-05, 'resolution': 512, 'lr_warmup_steps': 20}
z-image {'lora_rank': 16, 'learning_rate': 0.0001, 'resolution': 768}
krea-2 {'lora_rank': 32, 'learning_rate': 0.0003, 'resolution': 512}
sdxl {'lora_rank': 16, 'learning_rate': 0.0001, 'resolution': 1024}
=== the resulting config ===
flux.1 lr_scheduler='constant' lr_warmup_steps=20
qwen-image lr_scheduler='constant' lr_warmup_steps=20
flux.2-klein lr_scheduler='constant' lr_warmup_steps=20
flux.2-dev lr_scheduler='constant' lr_warmup_steps=20
And what get_scheduler does with that pair (diffusers 0.39.0, num_warmup_steps=20, num_training_steps=500, base LR 1e-4):
constant step1=1.00e-04 step10=1.00e-04 step20=1.00e-04 step25=1.00e-04
constant_with_warmup step1=5.00e-06 step10=5.00e-05 step20=1.00e-04 step25=1.00e-04
cosine step1=5.00e-06 step10=5.00e-05 step20=1.00e-04 step25=1.00e-04
linear step1=5.00e-06 step10=5.00e-05 step20=1.00e-04 step25=9.90e-05
get_scheduler returns schedule_func(optimizer) for SchedulerType.CONSTANT before it reaches the num_warmup_steps is None check, so the argument is discarded. Confirmed on a real FLUX.2 Klein 9B run earlier today: LR is 1e-4 at step 1.
The Train tab is not affected in practice, because the panel never seeds its warmup field from the family defaults (useState(0) in diffusion-train-panel.tsx, and it sends lr_warmup_steps: lrScheduler === "constant" ? 0 : lrWarmupSteps). So the recommendation is inert for UI users too, just silently rather than misleadingly. It bites an API client that applies defaults verbatim, which is what the field is published for.
Note on provenance
Upstream has the same pattern: the diffusers DreamBooth READMEs for FLUX.2 Klein and Z-Image both pass --lr_scheduler="constant" --lr_warmup_steps=100, which is equally inert there. One block of README_z_image.md uses constant_with_warmup, which is the variant that actually ramps. So this was inherited, not invented, but it is still an advertised default that does nothing.
Options
- Add
"lr_scheduler": "constant_with_warmup"to the four family defaults, and seed the Train panel's scheduler and warmup fields fromdefaultsthe way it already seeds rank, LR and resolution. Honours the stated intent, but changes training behaviour for those four families. - Drop
lr_warmup_stepsfrom the four entries. Truthful, and a no-op in practice, but abandons the intent.
I lean towards 1, since the comment says the ramp is wanted, but it is a behaviour change on four families and worth a deliberate call rather than a drive-by.
Found while auditing every Studio LoRA training path against the defect classes in #8267.
Activity