sgl-project/sglang · error · ValueError

camera_conditions must have last dimension 20, got {tuple(ca

Error message

camera_conditions must have last dimension 20, got {tuple(camera_conditions.shape)}

What it means

Each camera condition frame must be a 20-element vector (intrinsics + pose packed layout). The last dimension of the (B,T,·) tensor must be exactly 20.

Source

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

                else torch.as_tensor(camera_conditions)
            ).to(device=device, dtype=camera_compute_dtype)
            if camera_conditions.dim() == 2:
                camera_conditions = camera_conditions.unsqueeze(0)
            if camera_conditions.dim() != 3:
                raise ValueError(
                    "camera_conditions must have shape (T,20) or (B,T,20), "
                    f"got {tuple(camera_conditions.shape)}"
                )
            if camera_conditions.shape[0] == 1 and batch_size > 1:
                camera_conditions = camera_conditions.expand(batch_size, -1, -1)
            if camera_conditions.shape[0] != batch_size:
                raise ValueError(
                    "camera_conditions batch dimension must be 1 or match "
                    f"request batch size {batch_size}, got "
                    f"{camera_conditions.shape[0]}."
                )
            if camera_conditions.shape[-1] != 20:
                raise ValueError(
                    "camera_conditions must have last dimension 20, got "
                    f"{tuple(camera_conditions.shape)}"
                )
            if camera_conditions.shape[1] == T_lat:
                source = "prepacked"
                if chunk_plucker is None and requires_chunk_plucker:
                    raise ValueError(
                        "Prepacked latent-frame camera_conditions require "
                        "chunk_plucker for this SANA-WM checkpoint. Pass "
                        "chunk_plucker with shape (B,48,T,H,W), or pass "
                        "original-frame camera_conditions so SGLang can "
                        "derive chunk_plucker."
                    )
            else:
                source = "prebuilt_original_frames"
                original_camera_conditions = self._pad_or_trim_frames(
                    camera_conditions, num_frames
                )

View on GitHub (pinned to 0132848349)

Solutions

  1. Repack each frame's camera params into the 20-float layout (typically intrinsics + pose encoding) expected by this checkpoint.
  2. Check the model card / stage docs for the exact 20-dim composition.
  3. If you have camera_to_world matrices, pass camera_to_world/camera_path instead and let the stage build conditions.

Example fix

# before
camera_conditions = c2w.reshape(B, T, 16)
# after
resp = stage.forward(..., camera_to_world=c2w)  # let SGLang build (·,·,20)
Defensive patterns

Strategy: validation

Validate before calling

assert camera_conditions.shape[-1] == 20, camera_conditions.shape

Type guard

def is_camera_condition_layout(t) -> bool:
    return t.shape[-1] == 20

Prevention

When it happens

Trigger: Passing camera conditions packed as 16, 24, or 12 floats per frame, e.g. a 4x4 c2w matrix flattened to 16, or plücker rays in a different layout.

Common situations: Converting from another library's camera format (OpenCV rvec+tvec = 9 floats, c2w 4x4 = 16) without repacking into the 20-float layout SANA-WM expects.

Related errors


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