{"record":{"id":"60c02c871fc3c928","repo":"sgl-project/sglang","slug":"t-must-be-0-got-t","errorCode":null,"errorMessage":"T must be > 0, got {T}.","messagePattern":"T must be > 0, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py","lineNumber":360,"sourceCode":"    feats: torch.Tensor,\n    func_size_pairs: List[Tuple[Callable[[torch.Tensor], torch.Tensor], int]],\n) -> torch.Tensor:\n    funcs, block_sizes = zip(*func_size_pairs)\n    assert feats.shape[-1] == sum(block_sizes), (feats.shape, block_sizes)\n    x_blocks = torch.split(feats, list(block_sizes), dim=-1)\n    return torch.cat([f(b) for f, b in zip(funcs, x_blocks)], dim=-1)\n\n\ndef _sana_wm_chunk_index_from_chunk_size(\n    T: int,\n    chunk_size: int,\n    strategy: str = \"uniform\",\n) -> list[int]:\n    \"\"\"Return temporal chunk start indices.\"\"\"\n    if chunk_size <= 0:\n        raise ValueError(f\"chunk_size must be > 0, got {chunk_size}.\")\n    if T <= 0:\n        raise ValueError(f\"T must be > 0, got {T}.\")\n\n    strategy = \"uniform\" if strategy is None else str(strategy).lower()\n\n    if strategy in (\"uniform\", \"default\"):\n        indices = list(range(0, T, chunk_size))\n        if len(indices) > 1 and (T - indices[-1]) < chunk_size:\n            indices.pop()\n        return indices\n\n    if strategy in (\"first_frame\", \"first_frame_alone\", \"first_frame_only\"):\n        if T <= 1:\n            return [0]\n        indices = [0] + list(range(1, T, chunk_size))\n        if len(indices) > 2 and (T - indices[-1]) < chunk_size:\n            indices.pop()\n        return indices\n\n    if strategy in (\"first_plus_one\", \"first_chunk_plus_one\"):","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py#L342-L378","documentation":"The chunking helper requires T > 0, i.e. at least one latent frame. T=0 or negative means the latent has zero (or invalid) temporal extent and chunk boundaries are undefined.","triggerScenarios":"Calling with T = T_raw // patch_size_t when T_raw < patch_size_t (floordiv to 0), or with a video tensor whose temporal dim is 0.","commonSituations":"A single-frame clip fed to a model with temporal patch size 2; off-by-one slicing of video frames producing empty tensors; misparsed num_frames=0.","solutions":["Ensure the latent has at least patch_size_t frames (pad or reject too-short clips)","Fix upstream slicing so T_raw >= patch_size_t before dividing","Pass the true latent frame count T, not a pixel frame count of 0"],"exampleFix":"# before\nT = frames.shape[2] // p_t  # 0 when only 1 frame and p_t=2\n# after\nassert frames.shape[2] >= p_t, 'need at least p_t frames'\nT = frames.shape[2] // p_t","handlingStrategy":"validation","validationCode":"assert T_raw >= p_t, f'video too short: {T_raw} < {p_t}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject or pad clips shorter than one temporal patch before loading the model"],"tags":["sana-wm","chunking","empty-tensor","temporal-dim"],"backgroundTag":"invalid-argument-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}