sgl-project/sglang · error · ValueError
SANA-WM forward_long requires timestep.
Error message
SANA-WM forward_long requires timestep.
What it means
forward_long requires the diffusion timestep for each chunk; None raises immediately. Chunked streaming still denoises, so a timestep per chunk is mandatory.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/dits/sana_wm.py:758
chunk_plucker: Optional[torch.Tensor] = None,
*,
kv_cache: Optional[list] = None,
save_kv_cache: bool = True,
start_f: Optional[int] = None,
end_f: Optional[int] = None,
frame_index: Optional[torch.Tensor] = None,
**kwargs,
) -> Tuple[torch.Tensor, list]:
"""Streaming autoregressive forward over a chunk of latent frames.
RoPE / camera / plücker are windowed to the chunk's GLOBAL frame range
``[start_f, end_f)``; a per-block 10-slot ``kv_cache`` carries recurrent
state / concat-windows across chunks. Returns ``(out, new_cache)``.
"""
if encoder_hidden_states is None:
raise ValueError("SANA-WM forward_long requires encoder_hidden_states.")
if timestep is None:
raise ValueError("SANA-WM forward_long requires timestep.")
if kv_cache is None:
kv_cache = [[None] * _NUM_STREAM_CACHE_SLOTS for _ in self.blocks]
B, C, T_raw, H_raw, W_raw = hidden_states.shape
p_t, p_h, p_w = self.patch_size
T = T_raw // p_t
H = H_raw // p_h
W = W_raw // p_w
start = 0 if start_f is None else int(start_f)
end = start + T if end_f is None else int(end_f)
x = self.x_embedder(hidden_states.to(dtype=self.x_embedder.proj.weight.dtype))
# Timestep AdaLN-single: force the framewise (B, 1, T) path so blocks
# always apply per-frame modulation.
if timestep.dim() == 1:
timestep = timestep[:, None, None].expand(-1, 1, T)View on GitHub (pinned to 0132848349)
Solutions
- Pass the scheduler timestep tensor for the current denoising step to every forward_long chunk call
- Keep the same t across chunks within one denoising step
Example fix
# before out, cache = model.forward_long(h, ehs, start_f=sf, end_f=ef) # after out, cache = model.forward_long(h, t, encoder_hidden_states=ehs, start_f=sf, end_f=ef)
Defensive patterns
Strategy: validation
Validate before calling
assert timestep is not None at the top of your chunk loop
Prevention
- Keep (t, ehs) as an immutable tuple per denoising step
When it happens
Trigger: Calling forward_long without timestep or with timestep=None while iterating chunks.
Common situations: Streaming wrapper that supplies timestep only once, or per-pixel-frame instead of per-chunk; porting from a wrapper where t defaulted.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- SANA-WM forward requires timestep.
- SANA-WM forward_long requires encoder_hidden_states.
- SANA-WM forward requires encoder_hidden_states.
- Either chunk_index or chunk_size must be provided.
- num_frames/height/width are required when hidden_states is p
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/b0a28892e8eda375.
Report an issue: GitHub.