sgl-project/sglang · error · NotImplementedError

LingBot causal sequence sharding currently requires ulysses_

Error message

LingBot causal sequence sharding currently requires ulysses_degree > 1.

What it means

Sequence sharding in LingBot requires Ulysses degree > 1 — with degree 1 there is nothing to shard and the sharded code path (all-to-all packing, split handling) is not valid. If enable_sequence_shard is set with sp_size > 1 but the Ulysses group turns out to be size 1, the model refuses.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/dits/lingbot_world.py:1500

        current_start: int = 0,
        cache_start: int = 0,
        start_frame: int = 0,
        c2ws_plucker_emb: torch.Tensor | None = None,
        skip_final_projection: bool = False,
    ) -> torch.Tensor:
        forward_batch = get_forward_context().forward_batch
        sequence_shard_enabled = (
            forward_batch is not None
            and getattr(forward_batch, "enable_sequence_shard", False)
            and self.sp_size > 1
        )
        if sequence_shard_enabled:
            if get_ring_parallel_world_size() > 1:
                raise NotImplementedError(
                    "LingBot causal sequence sharding currently supports ulysses_degree > 1 with ring_degree = 1 only."
                )
            if get_ulysses_parallel_world_size() <= 1:
                raise NotImplementedError(
                    "LingBot causal sequence sharding currently requires ulysses_degree > 1."
                )
        orig_dtype = hidden_states.dtype
        if not isinstance(encoder_hidden_states, torch.Tensor):
            encoder_hidden_states = encoder_hidden_states[0]
        if (
            isinstance(encoder_hidden_states_image, list)
            and len(encoder_hidden_states_image) > 0
        ):
            encoder_hidden_states_image = encoder_hidden_states_image[0]
        else:
            encoder_hidden_states_image = None

        batch_size, _, num_frames, height, width = hidden_states.shape
        p_t, p_h, p_w = self.patch_size
        post_patch_num_frames = num_frames // p_t
        post_patch_height = height // p_h
        post_patch_width = width // p_w

View on GitHub (pinned to 0132848349)

Solutions

  1. Ensure Ulysses parallel groups are initialized before forward (correct launch flags/env) so world size matches sp_size
  2. Unset enable_sequence_shard if you actually intend a single-rank or non-Ulysses run
  3. Align sp_size with the Ulysses degree in server args

Example fix

# before
batch.enable_sequence_shard = True   # ulysses group size is 1

# after
batch.enable_sequence_shard = False  # or launch with --ulysses-size matching sp_size
Defensive patterns

Strategy: validation

Validate before calling

uly = get_ulysses_parallel_world_size()\nif getattr(forward_batch, 'enable_sequence_shard', False) and uly <= 1:\n    forward_batch.enable_sequence_shard = False

Prevention

When it happens

Trigger: forward_batch.enable_sequence_shard=True and self.sp_size > 1 while get_ulysses_parallel_world_size() == 1, e.g. SP configured via a different mechanism than the Ulysses group.

Common situations: Setting sp_size through one flag but initializing Ulysses groups elsewhere (partial init); leftover enable_sequence_shard from a previous config; env vars for ulysses not propagated to workers.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/3ee56ab535b7d07d. Report an issue: GitHub.