sgl-project/sglang · critical · ValueError

LTX-2 requires audio latents for denoising.

Error message

LTX-2 requires audio latents for denoising.

What it means

Every LTX-2 denoising step jointly denoises video and audio, so ctx.audio_latents must be set. If the audio latents were never prepared (None), the step cannot proceed and raises immediately.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/ltx_2/denoising.py:1717

        server_args: ServerArgs,
        step_index: int,
        t_int: int,
        timesteps_cpu: torch.Tensor,
    ):
        """Preserve the legacy LTX-2 attention-metadata contract."""
        # Legacy LTX-2 paths used the plain attention-metadata builder call here.
        return self._build_attn_metadata(step_index, batch, server_args)

    def _run_denoising_step(
        self,
        ctx: LTX2DenoisingContext,
        step: DenoisingStepState,
        batch: Req,
        server_args: ServerArgs,
    ) -> None:
        """Run one joint video/audio denoising step with LTX-2-specific guidance."""
        if ctx.audio_latents is None:
            raise ValueError("LTX-2 requires audio latents for denoising.")
        if ctx.audio_scheduler is None:
            raise ValueError("LTX-2 audio scheduler was not prepared.")

        # 1. Read the scheduler sigma pair and derive the Euler delta.
        sigmas = getattr(ctx.scheduler, "sigmas", None)
        if sigmas is None or not isinstance(sigmas, torch.Tensor):
            raise ValueError("Expected scheduler.sigmas to be a tensor for LTX-2.")
        sigma = sigmas[step.step_index].to(
            device=ctx.latents.device, dtype=torch.float32
        )
        sigma_next = sigmas[step.step_index + 1].to(
            device=ctx.latents.device, dtype=torch.float32
        )
        dt = sigma_next - sigma
        sigma_val = float(sigma.item())
        sigma_next_val = float(sigma_next.item())

        stage1_guider_params = self._get_ltx2_stage1_guider_params(

View on GitHub (pinned to 0132848349)

Solutions

  1. Provide audio (or silence) input so the audio VAE produces audio latents into ctx.audio_latents
  2. Verify the audio prep stage ran and assigns ctx.audio_latents for every request
  3. Route requests without audio to a pipeline variant that doesn't require audio latents

Example fix

// before
batch.audio = None  # -> ctx.audio_latents stays None
// after
batch.audio = batch.audio if batch.audio is not None else silence_clip(num_frames)
Defensive patterns

Strategy: validation

Validate before calling

if ctx.audio_latents is None:
    raise RuntimeError("audio latents missing: provide audio or route to non-audio pipeline")

Prevention

When it happens

Trigger: Calling _run_denoising_step with ctx.audio_latents is None — audio VAE encode skipped, prompt lacking audio, or prep stage not populating the field.

Common situations: Text-only or video-only prompt passed to an LTX-2 pipeline expecting audio latents; upstream audio encoder failure leaving the field unset; request routing a non-audio request into the LTX-2 stage.

Related errors


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