sgl-project/sglang · error · ValueError
SANA-WM denoising requires prepared timesteps.
Error message
SANA-WM denoising requires prepared timesteps.
What it means
Raised by the SANA-WM denoising forward when batch.timesteps is None — the diffusion scheduler's timestep tensor was never prepared on the request.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py:844
raise ValueError("SANA-WM denoising requires initialized latents.")
if batch.latents.ndim != 5:
raise ValueError(
"SANA-WM denoising expects 5D latents shaped (B, C, T, H, W), "
f"got {tuple(batch.latents.shape)}."
)
device = get_local_torch_device()
target_dtype = PRECISION_TO_TYPE.get(
getattr(server_args.pipeline_config, "dit_precision", "bf16"),
torch.bfloat16,
)
scheduler = getattr(
batch, "scheduler", None
) or get_or_create_request_scheduler(batch, self.scheduler)
self._move_scheduler_tensors_to_device(scheduler, device)
timesteps = batch.timesteps
if timesteps is None:
raise ValueError("SANA-WM denoising requires prepared timesteps.")
timesteps = timesteps.to(device=device)
latents = batch.latents.to(device=device, dtype=target_dtype)
init_latents = latents.clone()
condition_mask = torch.zeros_like(latents)
condition_mask[:, :, :1] = 1
pos_embeds = _to_device_dtype(
_first_tensor(server_args.pipeline_config.get_pos_prompt_embeds(batch)),
device=device,
dtype=target_dtype,
)
pos_mask = _to_device_dtype(
_first_tensor(batch.prompt_attention_mask), device=device
)
if pos_embeds is None:
raise ValueError("SANA-WM denoising requires positive prompt embeds.")
View on GitHub (pinned to 0132848349)
Solutions
- Ensure the init/before-denoising stage sets batch.timesteps from the scheduler
- Call scheduler.set_timesteps(...) and attach the tensor to the batch before denoising
- Check pipeline ordering so timesteps preparation precedes denoising
Defensive patterns
Strategy: validation
Validate before calling
assert batch.timesteps is not None
Type guard
def has_timesteps(batch) -> bool:
return getattr(batch, 'timesteps', None) is not None Prevention
- Attach scheduler timesteps to the batch in the init stage
- Test the full init->denoise handoff
When it happens
Trigger: Invoking the denoising stage without a preceding stage (typically latent init) having set batch.timesteps via the scheduler; scheduler present but timesteps not copied onto the batch.
Common situations: Skipped or reordered init stage; scheduler created but set_timesteps never ran; a request path that bypasses the standard preparation stage.
Related errors
- {self.config.timestep_spacing} is not supported. Please make
- Timesteps must be provided
- Only one of `timesteps` or `sigmas` can be passed. Please ch
- The current scheduler class {scheduler.__class__}'s `set_tim
- SANA-WM denoising requires initialized latents.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/64dc8914ac14dd29.
Report an issue: GitHub.