sgl-project/sglang · error · ValueError
action_mode is set but the loaded Cosmos3 checkpoint has no
Error message
action_mode is set but the loaded Cosmos3 checkpoint has no action modality (action_gen is False).
What it means
The request enables action generation via sampling_params.action_mode, but the loaded transformer has action_dim=None, i.e. the checkpoint lacks the action head. Action latents cannot be prepared without it, so the request is rejected.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py:616
if sound_duration > 0.0:
if not getattr(self.transformer, "sound_gen", False):
raise ValueError(
"sound generation was requested (sound_duration > 0) but the "
"loaded Cosmos3 checkpoint has no sound modality (sound_gen is "
"False)."
)
sound_latent_fps = self.transformer.sound_latent_fps
sound_latent_frames = max(1, round(sound_duration * sound_latent_fps))
sound_shape = (1, self.transformer.sound_dim, sound_latent_frames)
batch.audio_latents = torch.randn(
sound_shape, generator=generator, device=device, dtype=dtype
)
self.log_info(f"Prepared sound latents with shape {sound_shape}")
action_mode = getattr(batch.sampling_params, "action_mode", None)
if action_mode is not None:
if getattr(self.transformer, "action_dim", None) is None:
raise ValueError(
"action_mode is set but the loaded Cosmos3 checkpoint has no "
"action modality (action_gen is False)."
)
self._prepare_action_latents(batch, generator, device, dtype)
return batch
def component_uses(
self, server_args: ServerArgs, stage_name: str | None = None
) -> list[ComponentUse]:
return [ComponentUse(self._component_stage_name(stage_name), "vae")]
@staticmethod
def _resolve_domain_id(batch: Req) -> int:
"""Resolve action embodiment domain ID; required for action generation."""
domain_id = getattr(batch.sampling_params, "domain_id", None)
if domain_id is not None:
domain_id = int(domain_id)
if domain_id < 0:View on GitHub (pinned to 0132848349)
Solutions
- Remove action_mode from sampling params for non-action checkpoints
- Load an action-capable Cosmos3 checkpoint (action_dim is set)
- Check transformer.action_dim after load and gate action features on it
Example fix
# before sp.action_mode = 'policy' # checkpoint has no action head # after del sp.action_mode # or load action-capable checkpoint
Defensive patterns
Strategy: type-guard
Validate before calling
if sp.action_mode is not None and getattr(model.transformer, 'action_dim', None) is None:
sp.action_mode = None # checkpoint cannot do actions Type guard
def checkpoint_supports_action(transformer) -> bool:
return getattr(transformer, 'action_dim', None) is not None Prevention
- Gate action features on transformer.action_dim at load time
- Advertise only supported modalities in your API surface
When it happens
Trigger: Setting action_mode (e.g. 'policy' or 'forward_dynamics') on a checkpoint whose transformer.action_dim attribute is None (non-action Cosmos3 variant).
Common situations: Mixing robotics/action workflows with a plain video-generation checkpoint; assuming all Cosmos3 builds include action heads.
Related errors
- sound generation was requested (sound_duration > 0) but the
- domain_id must be non-negative, got {domain_id}
- Unknown action domain name {domain_name!r}. Valid names: {so
- action must have shape [T, D], got {tuple(action.shape)}
- Cosmos3 action input accepts one image field; use a list or
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/bcbc99e464ee7434.
Report an issue: GitHub.