sgl-project/sglang · error · ValueError
unsupported intrinsics shape {arr.shape}; expected (4,), (3,
Error message
unsupported intrinsics shape {arr.shape}; expected (4,), (3,3), or (F,3,3) What it means
Raised by sana_wm_load_intrinsics when the loaded array is not shape (4,), (3,3), or (F,3,3) with F >= num_frames. The function converts fx, fy, cx, cy vectors or 3x3 matrices into a (num_frames, 4) array.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py:245
raise ValueError(
f"camera trajectory must have shape (F, 4, 4); got {c2w.shape}"
)
return c2w
def sana_wm_load_intrinsics(path: Path, num_frames: int) -> np.ndarray:
arr = np.load(path).astype(np.float32)
if arr.shape == (4,):
return np.broadcast_to(arr, (num_frames, 4)).copy()
if arr.shape == (3, 3):
vec = np.array([arr[0, 0], arr[1, 1], arr[0, 2], arr[1, 2]], dtype=np.float32)
return np.broadcast_to(vec, (num_frames, 4)).copy()
if arr.ndim == 3 and arr.shape[1:] == (3, 3) and arr.shape[0] >= num_frames:
arr = arr[:num_frames]
return np.stack(
[arr[:, 0, 0], arr[:, 1, 1], arr[:, 0, 2], arr[:, 1, 2]], axis=1
)
raise ValueError(
f"unsupported intrinsics shape {arr.shape}; expected (4,), (3,3), or (F,3,3)"
)
def snap_sana_wm_num_frames(
num_frames: int, stride: int = 8, upper_bound: int | None = None
) -> int:
if num_frames < 1:
return 1
if (num_frames - 1) % stride == 0:
return min(num_frames, upper_bound) if upper_bound is not None else num_frames
floor_candidate = num_frames - ((num_frames - 1) % stride)
ceil_candidate = floor_candidate + stride
snapped = (
floor_candidate
if num_frames - floor_candidate < ceil_candidate - num_frames
else ceil_candidateView on GitHub (pinned to 0132848349)
Solutions
- Save intrinsics as a flat [fx, fy, cx, cy] array, or a single 3x3 K matrix
- Ensure per-frame (F,3,3) files have at least num_frames entries
- Double-check you're pointing at the intrinsics file, not the camera pose file
Example fix
# before np.save(path, K4x4) # (4,4) # after np.save(path, np.array([fx, fy, cx, cy])) # (4,)
Defensive patterns
Strategy: validation
Validate before calling
arr = np.load(path) assert arr.shape in [(4,), (3,3)] or (arr.ndim == 3 and arr.shape[1:] == (3,3) and arr.shape[0] >= num_frames)
Type guard
def intrinsics_ok(a, num_frames: int) -> bool:
return a.shape in ((4,), (3, 3)) or (a.ndim == 3 and a.shape[1:] == (3, 3) and a.shape[0] >= num_frames) Prevention
- Save intrinsics as [fx, fy, cx, cy]
- Keep per-frame intrinsics files at least as long as num_frames
When it happens
Trigger: Passing intrinsics arrays of shape (2,), (4,4), (F,4) with F<num_frames, or (F,3,3) with fewer frames than num_frames. Called from _prepare_intrinsics.
Common situations: Saving a 4x4 extrinsics matrix as intrinsics by mistake; a per-frame intrinsics file shorter than the requested frame count; saving (3,4) projection matrices.
Related errors
- camera trajectory must have shape (F, 4, 4); got {c2w.shape}
- action output dimensions must be non-zero, got {tuple(action
- action output must have shape [H, D] or [B, H, D], got {tupl
- SANA-WM denoising expects 5D latents shaped (B, C, T, H, W),
- condition_image tensor must be CHW or HWC with 1, 3, or 4 ch
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/e1902f2598be61fd.
Report an issue: GitHub.