sgl-project/sglang · error · ValueError

camera_conditions batch dimension must be 1 or match request

Error message

camera_conditions batch dimension must be 1 or match request batch size {batch_size}, got {camera_conditions.shape[0]}.

What it means

After normalization to (B,T,20), the leading batch dim must be 1 (auto-expanded to the request batch) or exactly equal to the request batch size. Any other value raises this ValueError.

Source

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

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

View on GitHub (pinned to 0132848349)

Solutions

  1. Make camera_conditions length match the number of requests in the batch.
  2. Pass a single (1,T,20) camera path to have it broadcast to all requests.
  3. Regenerate the camera tensor whenever the request batch composition changes.

Example fix

# before
cond = build_cameras_for(4_requests)  # (4,T,20) with batch_size=2
# after
cond = cond[:batch_size]  # or pass (1,T,20) to broadcast
Defensive patterns

Strategy: validation

Validate before calling

if cond.shape[0] not in (1, batch_size):
    cond = cond[:batch_size]  # or rebuild per request

Prevention

When it happens

Trigger: Sending a batch of N requests while camera_conditions has B cameras with 1 < B != N, e.g. 3 camera paths with batch_size=2.

Common situations: Mixing a per-prompt camera path list with batched server requests, or reusing a cached multi-camera conditioning tensor for a different request batch size.

Related errors


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