{"record":{"id":"3d6501f7da84d145","repo":"sgl-project/sglang","slug":"pi05-action-state-is-missing-on-single-rank-run","errorCode":null,"errorMessage":"Pi05 action state is missing on single-rank run","messagePattern":"Pi05 action state is missing on single-rank run","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/vlas/pi05_policy.py","lineNumber":1082,"sourceCode":"            \"runtime_role\": self.runtime_role,\n            \"world_size\": split.group.world_size,\n            \"prefix_root\": split.prefix_root,\n            \"action_root\": split.action_root,\n            \"action_ranks\": list(split.action_ranks),\n            \"action_sequence_parallel\": self._can_use_action_sequence_parallel(\n                prefix_context,\n                self.config.action_horizon,\n            ),\n        }\n\n    def _broadcast_initial_action_state(\n        self,\n        x_t: torch.Tensor | None,\n    ) -> torch.Tensor:\n        split = get_vla_split_group()\n        if split is None:\n            if x_t is None:\n                raise RuntimeError(\"Pi05 action state is missing on single-rank run\")\n            return x_t\n        x_t = broadcast_tensor_from_rank(\n            x_t,\n            split,\n            src=split.action_root,\n            device=self.device,\n        )\n        if x_t is None:\n            raise RuntimeError(\"Pi05 action state broadcast returned None\")\n        return x_t\n\n    def _shard_action_sequence(self, x_t: torch.Tensor) -> tuple[torch.Tensor, int]:\n        sp_world_size = get_sequence_parallel_world_size()\n        sp_rank = get_sp_parallel_rank()\n        local_len = x_t.shape[1] // sp_world_size\n        start = sp_rank * local_len\n        end = start + local_len\n        return x_t[:, start:end].contiguous(), start","sourceCodeStart":1064,"sourceCodeEnd":1100,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/vlas/pi05_policy.py#L1064-L1100","documentation":"During sample_actions with action sequence-parallelism configured, the initial noisy action tensor x_t is normally created on the action-root rank and broadcast to the group. On a single-rank run (get_vla_split_group() returns None) there is no broadcast, so the caller must supply x_t; if it is None the policy cannot proceed and raises. It indicates a code-path inconsistency rather than a user config problem.","triggerScenarios":"Calling sample_actions with x_t=None (the normal fallback path where the policy generates its own noise) while the run is single-rank / the VLA split group is not initialized — i.e. the internal condition that should have populated x_t did not fire.","commonSituations":"Running Pi05 inference without the distributed/sequence-parallel runtime initialized, or an sglang version mismatch where the fallback noise-initialization branch was removed or guarded differently; calling sample_actions directly in unit tests outside the scheduler.","solutions":["Run through the normal sglang serving/scheduler path so the distributed group and action-state plumbing is initialized","If calling sample_actions directly, pass an explicit x_t tensor of the right shape (float32, [batch, action_len, action_dim])","Update sglang — this path mismatch may be a fixed bug","Check that sequence-parallel flags are consistent: either fully enable action SP or fully disable it"],"exampleFix":"# before\nactions = policy.sample_actions(prefix, suffix, x_t=None)  # single-rank, raises\n\n# after\nx_t = torch.randn(batch, action_len, action_dim, device=policy.device, dtype=torch.float32)\nactions = policy.sample_actions(prefix, suffix, x_t=x_t)","handlingStrategy":"fallback","validationCode":"from sglang.multimodal_gen.runtime.models.vlas.pi05_policy import get_vla_split_group\nif get_vla_split_group() is None and x_t is None and not i_own_noise_init:\n    x_t = torch.randn(batch, action_len, action_dim, device=device, dtype=torch.float32)","typeGuard":null,"tryCatchPattern":"try:\n    actions = policy.sample_actions(prefix, suffix, x_t=x_t)\nexcept RuntimeError as e:\n    if \"action state is missing on single-rank run\" in str(e):\n        x_t = torch.randn(batch, action_len, action_dim,\n                          device=policy.device, dtype=torch.float32)\n        actions = policy.sample_actions(prefix, suffix, x_t=x_t)\n    else:\n        raise","preventionTips":["When calling sample_actions outside the scheduler, always pass an explicit x_t","Initialize the distributed/VLA split runtime through the standard sglang launcher rather than ad-hoc scripts"],"tags":["pi05","distributed","sequence-parallel","runtime-state"],"backgroundTag":"distributed-state-missing","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}