sgl-project/sglang · error · ValueError

chunk_plucker must have shape (48,T,H,W) or (B,48,T,H,W), go

Error message

chunk_plucker must have shape (48,T,H,W) or (B,48,T,H,W), got {tuple(chunk_plucker.shape)}

What it means

chunk_plucker (precomputed plücker ray embeddings) must be a 4-D (48,T,H,W) or 5-D (B,48,T,H,W) tensor. After unsqueezing 4-D input, any rank other than 5 raises this error.

Source

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

                chunk_plucker = compute_chunk_plucker(
                    camera_conditions=original_camera_conditions,
                    HW=(T_lat, sp_h, sp_w),
                    vae_temporal_stride=vae_temporal_stride,
                    patch_size=(1, 1, 1),
                )

        if chunk_plucker is not None:
            chunk_plucker = (
                chunk_plucker
                if isinstance(chunk_plucker, torch.Tensor)
                else torch.as_tensor(chunk_plucker)
            ).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)

View on GitHub (pinned to 0132848349)

Solutions

  1. Reshape to (48,T,H,W); add a leading batch dim only if you need per-request rays: (B,48,T,H,W).
  2. Verify the channel dim is 48 (two 24-chunk plücker groups) and it is dim 0.
  3. If you only have cameras, pass camera_conditions/camera_to_world and let the stage compute plücker.

Example fix

# before
plucker = plucker.permute(1,0,2,3)  # (T,48,H,W)
# after
plucker = plucker.permute(1,0,2,3).unsqueeze(0)  # (1,48,T,H,W)
Defensive patterns

Strategy: validation

Validate before calling

assert chunk_plucker.dim() in (4, 5), tuple(chunk_plucker.shape)
if chunk_plucker.dim() == 4:
    chunk_plucker = chunk_plucker.unsqueeze(0)

Type guard

def is_valid_chunk_plucker(t) -> bool:
    return isinstance(t, torch.Tensor) and t.dim() in (4,5) and (t.shape[-4] == 48)

Prevention

When it happens

Trigger: Passing an unbatched 3-D ray map, a per-pixel 6-D layout, or extra leading dims to diffusers_kwargs['chunk_plucker'].

Common situations: Exporting plücker coordinates from diffusers in an older layout, or stacking tensors along the wrong axis so the channel dim is not first.

Related errors


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