Skip to content

fix(neuron): Wan and HunyuanVideo 1.0 DiTs get the scheduler timestep in fp32 - #156

Merged
vijay-kodamalla merged 2 commits into
mainfrom
fix/neuron-timestep-fp32
Nov 11, 2026
Merged

vijay-kodamalla merged 2 commits into
mainfrom
fix/neuron-timestep-fp32

Conversation

@vijay-kodamalla

Copy link
Copy Markdown
Collaborator

diffusers passes the scheduler timestep to these DiTs unrounded (fp32); the native path cast it to bf16 with the other inputs. bf16 holds only multiples of 4 between 512 and 1024 (and of 2 between 256 and 512), which shifts the sinusoidal timestep embedding at every step. Same fix as LTX-2's (#142).

Change

  • The Wan and HunyuanVideo 1.0 native DiT adapters declare timestep_dtype = torch.float32 and send the timestep to the device in fp32; the other inputs keep the model dtype, in the module's argument order.
  • Warm-up inputs and input contracts declare the fp32 timestep, so the block graphs compile for it.
  • HunyuanVideo 1.0's pipeline builds the timestep in the DiT's declared dtype (model dtype otherwise: AoT and TPU unchanged); Wan's pipeline already did. The guidance input stays in the model dtype, as diffusers builds it; the HunyuanVideo TeaCache probe keeps its model-dtype timestep.
  • The models' time embeddings already handle an fp32 timestep as diffusers does (sinusoids in the timestep's dtype, then cast to the embedder's).

Verification

trn3.48xlarge, one chip, TP4, same prompt, seed 42 and 50 steps as the quality evaluation, against diffusers fp32 on GPU (mean / worst frame):

Model PSNR before → after SSIM before → after
HunyuanVideo 1.0, 320×512×61 21.81 / 20.55 → 27.08 / 26.36 dB 0.889 / 0.881 → 0.936 / 0.929
Wan 2.1, 480×832×9 24.33 / 22.31 → 27.02 / 24.72 dB 0.899 / 0.866 → 0.934 / 0.912
Wan 2.2 (both experts), 480×832×9 24.95 / 22.34 → 26.03 / 22.18 dB 0.915 / 0.888 → 0.908 / 0.848

The before numbers reproduce the quality evaluation's. HunyuanVideo 1.0 and Wan 2.1 improve on every metric; Wan 2.2 improves in mean PSNR with a lower worst-frame SSIM, within single-prompt sensitivity. Unit tests updated for the fp32 warm-up timestep and contracts.

@vijay-kodamalla
vijay-kodamalla merged commit c13fda3 into main Nov 11, 2026
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