{"record":{"id":"30ba11aa0eeefed2","repo":"sgl-project/sglang","slug":"sp-dmd-renoise-requires-batch-sp-audio-orig-num-f","errorCode":null,"errorMessage":"SP DMD renoise requires `batch.sp_audio_orig_num_frames`.","messagePattern":"SP DMD renoise requires `batch\\.sp_audio_orig_num_frames`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/joy_echo/denoising.py","lineNumber":224,"sourceCode":"            if not (isinstance(raw_shape, tuple) and len(raw_shape) == 3):\n                raise ValueError(\n                    \"SP DMD renoise requires packed video `batch.raw_latent_shape`.\"\n                )\n            full_reference = torch.empty(\n                tuple(raw_shape),\n                device=local_reference.device,\n                dtype=local_reference.dtype,\n            )\n            full_noise = self._randn_like_with_batch_generators(full_reference, batch)\n            sharded_noise, _ = server_args.pipeline_config.shard_latents_for_sp(\n                batch, full_noise\n            )\n            return sharded_noise\n\n        if shard_audio:\n            orig_audio_len = batch.sp_audio_orig_num_frames\n            if orig_audio_len <= 0:\n                raise ValueError(\n                    \"SP DMD renoise requires `batch.sp_audio_orig_num_frames`.\"\n                )\n            full_reference = torch.empty(\n                (\n                    int(local_reference.shape[0]),\n                    int(orig_audio_len),\n                    int(local_reference.shape[2]),\n                ),\n                device=local_reference.device,\n                dtype=local_reference.dtype,\n            )\n            full_noise = self._randn_like_with_batch_generators(full_reference, batch)\n            sharded_noise, _ = server_args.pipeline_config.shard_audio_latents_for_sp(\n                batch, full_noise\n            )\n            return sharded_noise\n\n        return self._randn_like_with_batch_generators(local_reference, batch)","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/joy_echo/denoising.py#L206-L242","documentation":"The audio branch of SP DMD renoise needs the original (unsharded) number of audio frames from batch.sp_audio_orig_num_frames to allocate the full reference tensor before sharding. A missing or non-positive value means SP audio metadata was never populated.","triggerScenarios":"Running with shard_audio=True when batch.sp_audio_orig_num_frames is unset, 0, or negative (e.g. an audio-less request routed through the sharded audio path).","commonSituations":"Enabling audio sharding for requests without audio; a batching stage skipping audio metadata for silent clips; version skew where the field was renamed.","solutions":["Ensure the audio encoding stage sets batch.sp_audio_orig_num_frames to the true audio latent frame count","Pass shard_audio=False when running without sequence parallelism","Verify audio latents exist for the request before enabling the JoyEcho audio path"],"exampleFix":"# before\n# batch built without audio SP metadata\n# after\nbatch.sp_audio_orig_num_frames = audio_latents.shape[1]  # orig (unsharded) frames","handlingStrategy":"validation","validationCode":"if shard_audio and not (getattr(batch, 'sp_audio_orig_num_frames', 0) or 0) > 0:\n    shard_audio = False  # or populate batch.sp_audio_orig_num_frames upstream","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Populate sp_audio_orig_num_frames in the audio encode stage","Skip the audio sharding path for audio-less requests"],"tags":["joyecho","sequence-parallel","audio","dmd","validation"],"backgroundTag":"missing-batch-metadata-for-parallelism","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}