sgl-project/sglang · error · NotImplementedError

LingBot causal sequence sharding currently supports ulysses_

Error message

LingBot causal sequence sharding currently supports ulysses_degree > 1 with ring_degree = 1 only.

What it means

LingBot's causal sequence-sharding implementation only handles Ulysses all-to-all with a single ring group (ring_degree=1). If ring parallelism is also active (ring world size > 1) the token partitioning logic is not implemented, so it raises NotImplementedError.

Source

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

        timestep: torch.LongTensor,
        encoder_hidden_states_image: torch.Tensor | list[torch.Tensor] | None = None,
        kv_cache: list[CausalSelfAttentionKVCache] | None = None,
        crossattn_cache: list[CrossAttentionKVCache] | None = None,
        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

View on GitHub (pinned to 0132848349)

Solutions

  1. Disable ring parallelism (run with ring_degree=1) while using sequence sharding
  2. Or drop sequence sharding and rely on ring attention for long contexts
  3. Wait for/port an implementation that composes ring + Ulysses sharding

Example fix

# before
--ring-size 2 --ulysses-size 4  (with enable_sequence_shard)

# after
--ring-size 1 --ulysses-size 4  (sequence sharding active)
Defensive patterns

Strategy: validation

Validate before calling

if shard_enabled and get_ring_parallel_world_size() > 1:\n    raise SystemExit('disable ring parallelism before enabling sequence sharding')

Prevention

When it happens

Trigger: Launching with both ring parallel degree > 1 and enable_sequence_shard with sp_size > 1, e.g. combining --ring-size with Ulysses sequence sharding.

Common situations: Trying to maximize multi-node parallelism by stacking ring + Ulysses; migrating configs from a Wan setup that used ring attention; default parallel plans enabling ring implicitly.

Related errors


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