{"record":{"id":"64dc8914ac14dd29","repo":"sgl-project/sglang","slug":"sana-wm-denoising-requires-prepared-timesteps","errorCode":null,"errorMessage":"SANA-WM denoising requires prepared timesteps.","messagePattern":"SANA-WM denoising requires prepared timesteps\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py","lineNumber":844,"sourceCode":"            raise ValueError(\"SANA-WM denoising requires initialized latents.\")\n        if batch.latents.ndim != 5:\n            raise ValueError(\n                \"SANA-WM denoising expects 5D latents shaped (B, C, T, H, W), \"\n                f\"got {tuple(batch.latents.shape)}.\"\n            )\n\n        device = get_local_torch_device()\n        target_dtype = PRECISION_TO_TYPE.get(\n            getattr(server_args.pipeline_config, \"dit_precision\", \"bf16\"),\n            torch.bfloat16,\n        )\n        scheduler = getattr(\n            batch, \"scheduler\", None\n        ) or get_or_create_request_scheduler(batch, self.scheduler)\n        self._move_scheduler_tensors_to_device(scheduler, device)\n        timesteps = batch.timesteps\n        if timesteps is None:\n            raise ValueError(\"SANA-WM denoising requires prepared timesteps.\")\n        timesteps = timesteps.to(device=device)\n\n        latents = batch.latents.to(device=device, dtype=target_dtype)\n        init_latents = latents.clone()\n        condition_mask = torch.zeros_like(latents)\n        condition_mask[:, :, :1] = 1\n\n        pos_embeds = _to_device_dtype(\n            _first_tensor(server_args.pipeline_config.get_pos_prompt_embeds(batch)),\n            device=device,\n            dtype=target_dtype,\n        )\n        pos_mask = _to_device_dtype(\n            _first_tensor(batch.prompt_attention_mask), device=device\n        )\n        if pos_embeds is None:\n            raise ValueError(\"SANA-WM denoising requires positive prompt embeds.\")\n","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py#L826-L862","documentation":"Raised by the SANA-WM denoising forward when batch.timesteps is None — the diffusion scheduler's timestep tensor was never prepared on the request.","triggerScenarios":"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.","commonSituations":"Skipped or reordered init stage; scheduler created but set_timesteps never ran; a request path that bypasses the standard preparation stage.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert batch.timesteps is not None","typeGuard":"def has_timesteps(batch) -> bool:\n    return getattr(batch, 'timesteps', None) is not None","tryCatchPattern":null,"preventionTips":["Attach scheduler timesteps to the batch in the init stage","Test the full init->denoise handoff"],"tags":["scheduler","timesteps","pipeline-order","sana-wm"],"backgroundTag":"missing-prerequisite-state","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}