{"record":{"id":"419afdba69bf5c56","repo":"sgl-project/sglang","slug":"cosmos3-action-generation-does-not-support-cfg-par","errorCode":null,"errorMessage":"Cosmos3 action generation does not support CFG parallel yet","messagePattern":"Cosmos3 action generation does not support CFG parallel yet","errorType":"error_code","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py","lineNumber":1089,"sourceCode":"                image_kwargs={},\n                pos_cond_kwargs={\n                    \"text_ids\": cond_text_ids,\n                    \"text_mask\": cond_text_mask,\n                    \"fps\": fps,\n                },\n                neg_cond_kwargs={\n                    \"text_ids\": uncond_text_ids,\n                    \"text_mask\": uncond_text_mask,\n                    \"fps\": fps,\n                },\n                guidance=None,\n            )\n\n        do_cfg = guidance_scale > 1.0\n\n        enable_cfg_parallel = server_args.enable_cfg_parallel and do_cfg\n        if action_latents is not None and enable_cfg_parallel:\n            raise NotImplementedError(\n                \"Cosmos3 action generation does not support CFG parallel yet\"\n            )\n\n        # Use separate scheduler instances for action/sound: UniPC keeps a\n        # per-call output history sized to the last sample, so video (5D),\n        # action (3D), and sound (3D) steps must not share state.\n        sound_scheduler = None\n        if sound_latents is not None:\n            sound_scheduler = copy.deepcopy(self.scheduler)\n            sound_scheduler.set_timesteps(len(timesteps), device=timesteps.device)\n        action_scheduler = None\n        if action_latents is not None:\n            action_scheduler = copy.deepcopy(self.scheduler)\n            action_scheduler.set_timesteps(len(timesteps), device=timesteps.device)\n        cfg_rank = get_classifier_free_guidance_rank() if enable_cfg_parallel else 0\n        cfg_world_size = (\n            get_classifier_free_guidance_world_size() if enable_cfg_parallel else 1\n        )","sourceCodeStart":1071,"sourceCodeEnd":1107,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py#L1071-L1107","documentation":"Cosmos3 raises NotImplementedError when action generation is combined with CFG parallelism (server_args.enable_cfg_parallel with guidance_scale > 1). The separate conditional/unconditional CFG-parallel batch streams are not wired up for the 3D action tensors, unlike video.","triggerScenarios":"Launching with --enable-cfg-parallel and guidance_scale > 1.0, then sending a request with action latents (DataType.ACTION path / action_latents not None) into forward.","commonSituations":"Copying a tuned video-generation launch config (CFG parallel on) to an action-dynamics workload; enabling global perf flags without checking modality support matrices.","solutions":["Disable --enable-cfg-parallel for action-generation workloads","Or set guidance_scale <= 1.0 so do_cfg (and thus enable_cfg_parallel) is False","Keep per-modality launch scripts so video-only perf flags don't leak into action runs"],"exampleFix":"# before\n--enable-cfg-parallel --guidance-scale 4.0  # action request -> NotImplementedError\n# after\n--guidance-scale 4.0  # CFG runs serially, works for actions","handlingStrategy":"validation","validationCode":"do_cfg = guidance_scale > 1.0\nassert not (server_args.enable_cfg_parallel and do_cfg and uses_action_latents), \"CFG parallel unsupported for action generation\"","typeGuard":"def cfg_parallel_ok(server_args, guidance_scale: float, has_actions: bool) -> bool:\n    return not (server_args.enable_cfg_parallel and guidance_scale > 1.0 and has_actions)","tryCatchPattern":null,"preventionTips":["Run action workloads on a server launched without --enable-cfg-parallel","Maintain separate launch scripts per modality","Check the stage's supported-flag matrix before enabling global perf flags"],"tags":["cosmos3","cfg-parallel","action-generation","not-implemented"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}