{"record":{"id":"923a17e49ea6b406","repo":"sgl-project/sglang","slug":"sana-wm-camera-conditions-must-be-sampled-at-laten","errorCode":null,"errorMessage":"SANA-WM camera_conditions must be sampled at latent frames: got {camera_conditions.shape[1]} frames, expected T={T}.","messagePattern":"SANA-WM camera_conditions must be sampled at latent frames: got (.+?) frames, expected T=(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/sana_wm.py","lineNumber":678,"sourceCode":"            encoder_attention_mask = encoder_attention_mask[0]\n        y = encoder_hidden_states\n        if y.dim() == 3:\n            y = y.unsqueeze(1)\n        y = self.y_embedder(y).squeeze(1)  # (B, L, D)\n        if y.shape[0] != B:\n            y = y.expand(B, -1, -1).contiguous()\n        if self.y_norm:\n            y = self.attention_y_norm(y)\n        if encoder_attention_mask is not None and encoder_attention_mask.shape[0] != B:\n            encoder_attention_mask = encoder_attention_mask.expand(B, -1).contiguous()\n\n        freqs = self._get_freqs(T, H, W, x.device)\n\n        # Camera conditioning: UCPE prope_fns + Plücker\n        prope_fns = None\n        if camera_conditions is not None:\n            if camera_conditions.shape[1] != T:\n                raise ValueError(\n                    \"SANA-WM camera_conditions must be sampled at latent \"\n                    f\"frames: got {camera_conditions.shape[1]} frames, \"\n                    f\"expected T={T}.\"\n                )\n            prope_fns = self._get_ucpe_apply_fns(\n                camera_conditions,\n                HW=(T, H, W),\n                freqs=freqs,\n            )\n\n        # Plücker post-attn embedding (shared across all blocks)\n        plucker_emb = None\n        needs_plucker_emb = (\n            chunk_plucker is not None\n            and self.plucker_embedder is not None\n            and (self.use_chunk_plucker_post_attn or self.use_chunk_plucker_input)\n        )\n        if needs_plucker_emb:","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/sana_wm.py#L660-L696","documentation":"The camera conditioning (intrinsics/extrinsics for UCPE) must have exactly T entries, one per latent frame, where T = T_raw // patch_size_t. Pixel-frame or wrong-frame-count camera parameters fail this check.","triggerScenarios":"Passing camera_conditions with shape[1] != T — e.g. cameras sampled at every pixel frame (T_raw) instead of temporal-patch-downsampled latent frames, or a single camera for a multi-frame latent.","commonSituations":"Reusing dataset camera trajectories at video frame rate; mismatch between video temporal patch size (e.g. 1x vs 2x compression) and camera sampling rate.","solutions":["Resample camera_conditions to one entry per latent frame: index every p_t-th frame","Verify hidden_states.shape[2] // patch_size[0] equals camera_conditions.shape[1]","Check the model config's patch_size_t matches your camera sampling assumption"],"exampleFix":"# before\ncam = cameras  # (B, T_raw, ...)\nout = model(h, t, ehs, camera_conditions=cam)\n# after\np_t = model.patch_size[0]\ncam = cameras[:, ::p_t]  # (B, T, ...)\nassert cam.shape[1] == h.shape[2] // p_t\nout = model(h, t, ehs, camera_conditions=cam)","handlingStrategy":"validation","validationCode":"T = h.shape[2] // model.patch_size[0]\nif camera_conditions is not None:\n    assert camera_conditions.shape[1] == T, (camera_conditions.shape, T)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sample cameras at latent frame rate: cameras[:, ::p_t]","Add a geometry dataclass carrying (latent, cameras) built together"],"tags":["sana-wm","camera-conditions","shape-mismatch","latent-frames"],"backgroundTag":"tensor-shape-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}