{"record":{"id":"d4b0f897cb1ac84f","repo":"sgl-project/sglang","slug":"streaming-needs-num-frame-per-block-latent-fr","errorCode":null,"errorMessage":"streaming needs >= {num_frame_per_block} latent frames, got {total_frames}.","messagePattern":"streaming needs >= (.+?) latent frames, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming.py","lineNumber":602,"sourceCode":"        sink_token = sampler_cfg.sink_token\n        explicit_sigmas = sc.explicit_sigmas\n        cfg_scale = sc.cfg_scale\n        do_cfg = sc.do_cfg\n        embeds_in, mask_in, cam_in, plk_in = sc.embeds, sc.mask, sc.camera, sc.plucker\n\n        # parity harness: full-length conditioning fed to forward_long (windowed\n        # internally per chunk via [start_f:end_f]).\n        _fdump(\"cond_embeds\", embeds_in)\n        _fdump(\"cond_mask\", mask_in)\n        _fdump(\"cond_camera\", cam_in)\n        _fdump(\"cond_plucker\", plk_in)\n\n        scheduler = FlowMatchEulerDiscreteScheduler(shift=1.0)\n\n        chunk_indices = self._autoregressive_segments(total_frames, num_frame_per_block)\n        num_chunks = len(chunk_indices) - 1\n        if num_chunks < 1:\n            raise ValueError(\n                f\"streaming needs >= {num_frame_per_block} latent frames, got {total_frames}.\"\n            )\n\n        start_time = time.perf_counter()\n        with self.use_declared_component(\n            component_name=\"transformer\", module=self.transformer\n        ) as transformer:\n            assert transformer is not None\n            self.transformer = transformer\n            num_blocks = len(transformer.blocks)\n            if _dump_dir:  # parity harness: weights fingerprint\n                parity_probe.dump_obj(\n                    _dump_dir,\n                    \"dit_fingerprint\",\n                    parity_probe.weights_fingerprint(transformer),\n                )\n            kv_cache = [\n                [[None] * _NUM_STREAM_CACHE_SLOTS for _ in range(num_blocks)]","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming.py#L584-L620","documentation":"_forward_offline chunks the total latent frames into autoregressive blocks of num_frame_per_block. It requires at least one full block (total_frames >= num_frame_per_block); otherwise num_chunks < 1 and it raises with the required minimum echoed.","triggerScenarios":"Requesting a video so short its latent frame count is below num_frame_per_block (e.g. duration*fps/temporal-compression yields 0 or partial frames), or num_frame_per_block configured larger than the generated length.","commonSituations":"Very short clips (sub-second durations); raising num_frame_per_block for throughput without regenerating latent length; fps/duration math producing fewer frames than expected.","solutions":["Increase the requested duration/frames so total latent frames >= num_frame_per_block","Lower num_frame_per_block to fit the clip","Check temporal-compression and fps settings compute the intended frame count"],"exampleFix":"# before\nserver_args.pipeline_config.sampler.num_frame_per_block = 8\nreq.duration = 0.2  # yields ~3 latent frames\n# after\nreq.duration = 1.0  # yields >= 8 latent frames","handlingStrategy":"validation","validationCode":"assert total_frames >= num_frame_per_block, f\"need >= {num_frame_per_block} latent frames, got {total_frames}\"","typeGuard":"def long_enough(total_frames: int, block: int) -> bool:\n    return total_frames >= block","tryCatchPattern":"null","preventionTips":["Compute latent frames from duration/fps before admitting short requests","Clamp or reject requests shorter than num_frame_per_block at the API layer","Re-validate when tuning num_frame_per_block"],"tags":["sana-wm","streaming","frame-count","block-size","valueerror"],"backgroundTag":"insufficient-input-length","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}