{"record":{"id":"f8412aa1f05ad915","repo":"sgl-project/sglang","slug":"sound-generation-was-requested-sound-duration-0","errorCode":null,"errorMessage":"sound generation was requested (sound_duration > 0) but the loaded Cosmos3 checkpoint has no sound modality (sound_gen is False).","messagePattern":"sound generation was requested \\(sound_duration > 0\\) but the loaded Cosmos3 checkpoint has no sound modality \\(sound_gen is False\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py","lineNumber":600,"sourceCode":"            self.log_info(\n                f\"Prepared {mode} latents with conditioning at frames {cond_indexes}\"\n            )\n        else:\n            latents = noise\n\n        batch.latents = latents\n        batch.raw_latent_shape = shape\n\n        batch.extra[\"video_shape\"] = (num_latent_frames, height_latent, width_latent)\n        batch.extra[\"vae_scale_factor_temporal\"] = vae_scale_factor_temporal\n        batch.extra[\"vae_scale_factor_spatial\"] = vae_scale_factor_spatial\n\n        self.log_info(f\"Prepared latents with shape {shape}\")\n\n        sound_duration = float(getattr(batch, \"sound_duration\", 0.0) or 0.0)\n        if sound_duration > 0.0:\n            if not getattr(self.transformer, \"sound_gen\", False):\n                raise ValueError(\n                    \"sound generation was requested (sound_duration > 0) but the \"\n                    \"loaded Cosmos3 checkpoint has no sound modality (sound_gen is \"\n                    \"False).\"\n                )\n            sound_latent_fps = self.transformer.sound_latent_fps\n            sound_latent_frames = max(1, round(sound_duration * sound_latent_fps))\n            sound_shape = (1, self.transformer.sound_dim, sound_latent_frames)\n            batch.audio_latents = torch.randn(\n                sound_shape, generator=generator, device=device, dtype=dtype\n            )\n            self.log_info(f\"Prepared sound latents with shape {sound_shape}\")\n\n        action_mode = getattr(batch.sampling_params, \"action_mode\", None)\n        if action_mode is not None:\n            if getattr(self.transformer, \"action_dim\", None) is None:\n                raise ValueError(\n                    \"action_mode is set but the loaded Cosmos3 checkpoint has no \"\n                    \"action modality (action_gen is False).\"","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py#L582-L618","documentation":"The request asks for audio output (sound_duration > 0 in sampling params), but the loaded Cosmos3 transformer checkpoint has sound_gen=False, meaning it was trained without the sound modality and cannot produce sound latents. The stage refuses rather than silently dropping the audio.","triggerScenarios":"Passing sound_duration > 0 while the loaded checkpoint's transformer.sound_gen attribute is False (a video-only Cosmos3 model).","commonSituations":"Loading a video-only Cosmos3 checkpoint and reusing request params from a video+audio variant; upgrading/downgrading between checkpoint variants.","solutions":["Remove sound_duration (or set it to 0) to request video-only generation","Load a Cosmos3 checkpoint variant that includes the sound modality (sound_gen=True)","Verify transformer.sound_gen after model load and route audio requests accordingly"],"exampleFix":"# before\nsp.sound_duration = 4.0  # video-only checkpoint\n\n# after\nsp.sound_duration = 0.0  # or load audio-capable checkpoint","handlingStrategy":"type-guard","validationCode":"sound_ok = getattr(model.transformer, 'sound_gen', False)\nif sp.sound_duration and not sound_ok:\n    sp.sound_duration = 0.0  # or raise to caller","typeGuard":"def checkpoint_supports_sound(transformer) -> bool:\n    return bool(getattr(transformer, 'sound_gen', False))","tryCatchPattern":null,"preventionTips":["Check sound_gen after model load and expose it in your capability metadata","Default sound_duration to 0 unless audio is confirmed supported"],"tags":["cosmos3","audio","checkpoint-capability","validation"],"backgroundTag":"unsupported-model-capability","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}