sgl-project/sglang · critical · ValueError
LTX-2 audio scheduler was not prepared.
Error message
LTX-2 audio scheduler was not prepared.
What it means
_before_denoising_loop asserts that the LTX-2 audio scheduler (ctx.audio_scheduler) was constructed during preparation. LTX-2 does joint video+audio denoising, so a missing audio scheduler means the prep stage never ran or failed silently.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/ltx_2/denoising.py:1690
# cfg-parallel batches are broadcast from rank 0; scheduler state must be local
for name in ("sigmas", "timesteps"):
value = getattr(scheduler, name, None)
if isinstance(value, torch.Tensor):
setattr(scheduler, name, value.to(device))
def _before_denoising_loop(
self, ctx: LTX2DenoisingContext, batch: Req, server_args: ServerArgs
) -> None:
"""Reset the mirrored audio scheduler before the shared loop begins."""
if is_ltx2_two_stage_pipeline_name(
server_args.pipeline_class_name
) and ctx.stage in ("stage1", "stage2"):
pipeline = self.pipeline() if self.pipeline else None
if pipeline is not None:
pipeline.switch_lora_phase(ctx.stage, batch=batch)
super()._before_denoising_loop(ctx, batch, server_args)
if ctx.audio_scheduler is None:
raise ValueError("LTX-2 audio scheduler was not prepared.")
ctx.audio_scheduler.set_begin_index(0)
if self.sampler_name == "res2s" and ctx.use_native_hq_res2s_sde_noise:
self._ltx2_init_res2s_noise_generators(ctx)
def _prepare_step_attn_metadata(
self,
ctx: LTX2DenoisingContext,
batch: Req,
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(View on GitHub (pinned to 0132848349)
Solutions
- Ensure the LTX-2 prepare path that builds ctx.audio_scheduler runs before _before_denoising_loop
- Check for config flags that disable audio-scheduler init and disable them or route to a non-LTX-2 stage
- Grep for where audio_scheduler is assigned and confirm it isn't conditionally skipped for your request type
Example fix
// before ctx.audio_scheduler = build_audio_scheduler(cfg) if enable_audio else None // after ctx.audio_scheduler = build_audio_scheduler(cfg) # required for LTX-2 stage assert ctx.audio_scheduler is not None
Defensive patterns
Strategy: validation
Validate before calling
assert ctx.audio_scheduler is not None, "audio scheduler missing; check prepare stage"
Prevention
- Fail fast right after the prepare stage instead of at loop start
- Don't add config paths that skip audio-scheduler construction for LTX-2
When it happens
Trigger: ctx.audio_scheduler is None at loop start — e.g. the prepare stage skipped audio scheduler construction (audio disabled path, exception swallowed, or stage ordering changed).
Common situations: Running an LTX-2 pipeline variant with audio disabled but still entering the joint loop; a refactor reordering prepare vs loop stages; a config flag that skips audio init without skipping the LTX-2 stage.
Related errors
- padding_side must be 'left' or 'right', got {padding_side}
- Unsupported text encoder output: expected `hidden_states`.
- num_inference_steps must be positive, got {steps}
- LTX-2 SP time-sharding for packed token latents currently re
- Expected {seq_len=} > 0 for packed token latents.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/bdb27557704caace.
Report an issue: GitHub.