sgl-project/sglang · error · ValueError

chunk_plucker shape mismatch for SANA-WM: expected {expected

Error message

chunk_plucker shape mismatch for SANA-WM: expected {expected_chunk_shape}, got {tuple(chunk_plucker.shape)}.

What it means

chunk_plucker must exactly equal (batch_size, 48, T_lat, sp_h, sp_w) where T_lat is the latent frame count and sp_h/sp_w the spatial latent resolution. Mismatched temporal or spatial extents raise this error.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py:2141

            ).to(device=device, dtype=dtype)
            if chunk_plucker.dim() == 4:
                chunk_plucker = chunk_plucker.unsqueeze(0)
            if chunk_plucker.shape[0] == 1 and batch_size > 1:
                chunk_plucker = chunk_plucker.expand(batch_size, -1, -1, -1, -1)
            if chunk_plucker.dim() != 5:
                raise ValueError(
                    "chunk_plucker must have shape (48,T,H,W) or "
                    f"(B,48,T,H,W), got {tuple(chunk_plucker.shape)}"
                )
            if chunk_plucker.shape[0] != batch_size:
                raise ValueError(
                    "chunk_plucker batch dimension must be 1 or match "
                    f"request batch size {batch_size}, got "
                    f"{chunk_plucker.shape[0]}."
                )
            expected_chunk_shape = (batch_size, 48, T_lat, sp_h, sp_w)
            if tuple(chunk_plucker.shape) != expected_chunk_shape:
                raise ValueError(
                    "chunk_plucker shape mismatch for SANA-WM: expected "
                    f"{expected_chunk_shape}, got {tuple(chunk_plucker.shape)}."
                )

        if camera_conditions is not None:
            camera_conditions = camera_conditions.to(device=device, dtype=dtype)

        return camera_conditions, chunk_plucker, source

    def _prepare_timesteps(
        self,
        batch: Req,
        server_args: ServerArgs,
        device: torch.device,
    ):
        """Set up scheduler timesteps and populate batch.timesteps, .sigmas."""
        scheduler = get_or_create_request_scheduler(batch, self.scheduler)
        num_inference_steps = batch.num_inference_steps

View on GitHub (pinned to 0132848349)

Solutions

  1. Recompute chunk_plucker at latent resolution: T = T_lat frames, H = sp_h, W = sp_w spatial dims.
  2. Or pass original-frame camera_conditions so SGLang resamples plücker correctly for the current latent shape.
  3. Check for swapped H/W when exporting from a different convention.

Example fix

# before
stage.forward(..., diffusers_kwargs={'camera_conditions': pre, 'chunk_plucker': full_res_plucker})
# after
stage.forward(..., diffusers_kwargs={'camera_conditions': original_frame_cond})  # derive plücker at latent res
Defensive patterns

Strategy: validation

Validate before calling

expected = (batch_size, 48, T_lat, sp_h, sp_w)
assert tuple(chunk_plucker.shape) == expected, (tuple(chunk_plucker.shape), expected)

Prevention

When it happens

Trigger: Passing plücker rays computed at the pixel resolution or original frame rate (H,W,T instead of sp_h,sp_w,T_lat), or with H/W swapped.

Common situations: Porting precomputed diffusers ray maps that were not downsampled to the latent grid, or aspect-ratio changes between generation settings and the cached tensor.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/1cec256197545451. Report an issue: GitHub.