sgl-project/sglang · error · ValueError

SP DMD renoise requires `batch.sp_audio_orig_num_frames`.

Error message

SP DMD renoise requires `batch.sp_audio_orig_num_frames`.

What it means

The audio branch of SP DMD renoise needs the original (unsharded) number of audio frames from batch.sp_audio_orig_num_frames to allocate the full reference tensor before sharding. A missing or non-positive value means SP audio metadata was never populated.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/joy_echo/denoising.py:224

            if not (isinstance(raw_shape, tuple) and len(raw_shape) == 3):
                raise ValueError(
                    "SP DMD renoise requires packed video `batch.raw_latent_shape`."
                )
            full_reference = torch.empty(
                tuple(raw_shape),
                device=local_reference.device,
                dtype=local_reference.dtype,
            )
            full_noise = self._randn_like_with_batch_generators(full_reference, batch)
            sharded_noise, _ = server_args.pipeline_config.shard_latents_for_sp(
                batch, full_noise
            )
            return sharded_noise

        if shard_audio:
            orig_audio_len = batch.sp_audio_orig_num_frames
            if orig_audio_len <= 0:
                raise ValueError(
                    "SP DMD renoise requires `batch.sp_audio_orig_num_frames`."
                )
            full_reference = torch.empty(
                (
                    int(local_reference.shape[0]),
                    int(orig_audio_len),
                    int(local_reference.shape[2]),
                ),
                device=local_reference.device,
                dtype=local_reference.dtype,
            )
            full_noise = self._randn_like_with_batch_generators(full_reference, batch)
            sharded_noise, _ = server_args.pipeline_config.shard_audio_latents_for_sp(
                batch, full_noise
            )
            return sharded_noise

        return self._randn_like_with_batch_generators(local_reference, batch)

View on GitHub (pinned to 0132848349)

Solutions

  1. Ensure the audio encoding stage sets batch.sp_audio_orig_num_frames to the true audio latent frame count
  2. Pass shard_audio=False when running without sequence parallelism
  3. Verify audio latents exist for the request before enabling the JoyEcho audio path

Example fix

# before
# batch built without audio SP metadata
# after
batch.sp_audio_orig_num_frames = audio_latents.shape[1]  # orig (unsharded) frames
Defensive patterns

Strategy: validation

Validate before calling

if shard_audio and not (getattr(batch, 'sp_audio_orig_num_frames', 0) or 0) > 0:
    shard_audio = False  # or populate batch.sp_audio_orig_num_frames upstream

Prevention

When it happens

Trigger: Running with shard_audio=True when batch.sp_audio_orig_num_frames is unset, 0, or negative (e.g. an audio-less request routed through the sharded audio path).

Common situations: Enabling audio sharding for requests without audio; a batching stage skipping audio metadata for silent clips; version skew where the field was renamed.

Related errors


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