sgl-project/sglang · error · ValueError
camera_conditions must have shape (T,20) or (B,T,20), got {t
Error message
camera_conditions must have shape (T,20) or (B,T,20), got {tuple(camera_conditions.shape)} What it means
SANA-WM video generation stage validates the camera_conditions tensor in _build_camera_conditioning. After converting to a tensor and unsqueezing a 2-D input, it requires exactly 3 dimensions: (B, T, 20). A 1-D, 4-D, or higher-rank input raises this ValueError.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py:1875
or getattr(arch, "use_chunk_plucker_input", False)
)
if action is not None and (
camera_conditions is not None or chunk_plucker is not None
):
raise ValueError(
"SANA-WM action cannot be combined with prepacked "
"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"View on GitHub (pinned to 0132848349)
Solutions
- Reshape camera_conditions to (T,20) (single request) or (B,T,20) (batched), e.g. cond.unsqueeze(0) for an unbatched path.
- If frames were nested per-key, flatten the last dims so each timestep is one 20-vector.
- Print camera_conditions.shape right before calling forward to confirm rank.
Example fix
# before camera_conditions = intrinsics_20 # shape (20,) # after camera_conditions = intrinsics_20.unsqueeze(0) # shape (1,20)
Defensive patterns
Strategy: validation
Validate before calling
def check_camera_conditions(cc, batch_size):
t = cc if isinstance(cc, torch.Tensor) else torch.as_tensor(cc)
assert t.dim() in (2, 3), f"need (T,20) or (B,T,20), got {tuple(t.shape)}"
return t Type guard
def is_valid_camera_conditions(t) -> bool:
return isinstance(t, torch.Tensor) and t.dim() in (2,3) and t.shape[-1] == 20 Prevention
- Always build camera_conditions with an explicit .reshape(-1, 20) before passing.
- Log tuple(shape) before forward in new integrations.
When it happens
Trigger: Passing camera_conditions as a flat vector (e.g. shape (20,)), a 4-D tensor (B, T, F, 20), or any rank other than 2 or 3 to the SANA-WM forward via diffusers_kwargs['camera_conditions']. A shape-(T,20) input is fine; anything else is not.
Common situations: Users porting diffusers camera-conditioned pipelines where camera arrays were nested per-frame lists (producing 4-D), or accidentally passing a single frame's 20-vector instead of a sequence.
Related errors
- camera_conditions batch dimension must be 1 or match request
- camera_conditions must have last dimension 20, got {tuple(ca
- chunk_plucker must have shape (48,T,H,W) or (B,48,T,H,W), go
- The pointers must be multiple of 16 bytes.
- The last dimension ({input.shape[-1]}) x itemsize ({input.dt
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/e8cc133414d058b7.
Report an issue: GitHub.