You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pass min_snr_gamma_soft to apply_snr_weight and apply_snr_weight_for_flow_matching
Wire the --min_snr_gamma_soft flag (args.min_snr_gamma_soft) through to the
soft kwarg at all 21 call sites across the codebase:
apply_snr_weight (12 sites): train_network, fine_tune, train_db, train_leco,
sdxl_train, sdxl_train_leco, sdxl_train_control_net,
sdxl_train_control_net_lllite, sdxl_train_control_net_lllite_old,
train_control_net, train_textual_inversion, train_textual_inversion_XTI.
apply_snr_weight_for_flow_matching (9 sites): flux_train, sd3_train,
lumina_train, anima_train, flux_train_network, sd3_train_network,
lumina_train_network, hunyuan_image_train_network, anima_train_network.
Both functions already accept soft: bool = False. The --min_snr_gamma_soft
flag and soft-mode implementations in custom_train_functions.py were already
in place. This commit connects the training args to the function calls.
Adds test_apply_snr_weight_soft.py with 34 tests covering:
- Soft vs hard weight formula correctness for both DDPM and flow matching
- Edge cases (sigma=0, sigma=1, near-zero clamping)
- Gradient flow through soft weights
- Smoothness advantage of soft over hard at gamma threshold
- CLI argument parsing for --min_snr_gamma_soft
help="gamma for reducing the weight of high loss timesteps. Lower numbers have stronger effect. 5 is recommended by paper. / 低いタイムステップでの高いlossに対して重みを減らすためのgamma値、低いほど効果が強く、論文では5が推奨",
175
205
)
206
+
207
+
parser.add_argument(
208
+
"--min_snr_gamma_soft",
209
+
action="store_true",
210
+
help="Controls if min_snr_gamma uses soft implementation from https://arxiv.org/abs/2401.11605.",
0 commit comments