Skip to content

fix: convert boundary_ratio from timestep space to index space via inverse sigma_shift#32

Open
Auraithm wants to merge 1 commit intoOpenMOSS:mainfrom
Auraithm:main
Open

fix: convert boundary_ratio from timestep space to index space via inverse sigma_shift#32
Auraithm wants to merge 1 commit intoOpenMOSS:mainfrom
Auraithm:main

Conversation

@Auraithm
Copy link

Summary

boundary_ratio=0.9 represents the DiT1/DiT2 switch point at timestep 900. In inference, this value is correctly compared against actual timestep values. However, in training_step, it was incorrectly used as an index fraction for max/min_timestep_boundary.

Due to sigma_shift (flow_match.py L57), the scheduler's timestep array is non-linearly spaced — timestep 900 sits at index ~250 (shift=3), not index 900. Using 0.9 as the index boundary caused DiT1 to be trained on 90% of indices and DiT2 on only 10%, while in inference DiT2 handles the majority of denoising (timestep 900→0).

Fix

Apply inverse sigma_shift to convert boundary_ratio from timestep space to index space before passing it to max/min_timestep_boundary. This aligns training with inference behavior.

  • shift=3 → index boundary = 0.25
  • shift=5 → index boundary = 0.358 (matches DiffSynth-Studio PR #806)

Reference

@tianyilt
Copy link
Collaborator

上下文:这里的 boundary 应该是 sigma_shift 前的 index 边界
比如modelscope/DiffSynth-Studio#806

因此不要硬编码:switch_dit_boundary: float = 0.358, #FIXME(dhyu):

@tianyilt
Copy link
Collaborator

@Auraithm 最好贴个测试通过的例子

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants