sgl-project/sglang · error · ValueError

SANA-WM streaming decode requires AutoencoderKLCausalLTX2Vid

Error message

SANA-WM streaming decode requires AutoencoderKLCausalLTX2Video (decode_chunk). Point --component_paths.vae at the ltx2_causal_vae weights when streaming.

What it means

Streaming decode requires the LTX-2 causal video VAE (AutoencoderKLCausalLTX2Video) because it decodes via decode_chunk for causally-consistent chunked decoding. If the loaded VAE object lacks decode_chunk (e.g. a standard KL VAE), the stage raises with the remedy: point --component_paths.vae at the ltx2_causal_vae weights.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming.py:745

class SanaWMStreamingDecodingStage(DecodingStage):
    """Streaming causal-VAE decode over the SAME autoregressive grid the denoise stage used.

    Carries a per-conv decoder cache across chunks so the causal LTX-2 VAE produces
    seam-free frames (the `decode_per_frame_with_cache` equivalent at chunk granularity).
    Subclasses DecodingStage directly (NOT SanaWMDecodingStage, whose long-video config
    re-enables the stateless tiled decode).
    """

    @torch.no_grad()
    def decode(
        self,
        latents: torch.Tensor,
        server_args: ServerArgs,
        *,
        vae_dtype: torch.dtype,
    ) -> torch.Tensor:
        if not hasattr(self.vae, "decode_chunk"):
            raise ValueError(
                "SANA-WM streaming decode requires AutoencoderKLCausalLTX2Video "
                "(decode_chunk). Point --component_paths.vae at the ltx2_causal_vae "
                "weights when streaming."
            )
        device = get_local_torch_device()
        latents = latents.to(device)
        pcfg = server_args.pipeline_config
        num_frame_per_block = int(getattr(pcfg, "num_frame_per_block", 3))
        total_frames = latents.shape[2]
        segments = SanaWMStreamingDenoisingStage._autoregressive_segments(
            total_frames, num_frame_per_block
        )
        conv_cache = self.vae.reset_decoder_cache()
        chunks = []
        for i in range(len(segments) - 1):
            s, e = segments[i], segments[i + 1]
            z = self.scale_and_shift(latents[:, :, s:e].to(vae_dtype), server_args)
            # No autocast: match the official decode (VAE already runs in vae_dtype,

View on GitHub (pinned to 0132848349)

Solutions

  1. Set --component_paths.vae to the ltx2_causal_vae weights for streaming runs
  2. Verify the loaded object is AutoencoderKLCausalLTX2Video (hasattr(vae, 'decode_chunk'))
  3. Download/place the causal VAE checkpoint and restart the server

Example fix

# before
python -m sglang.launch_server --model sana-wm ...  # default VAE
# after
python -m sglang.launch_server --model sana-wm \
  --component_paths.vae /path/to/ltx2_causal_vae
Defensive patterns

Strategy: validation

Validate before calling

assert hasattr(vae, "decode_chunk"), "load ltx2_causal_vae via --component_paths.vae for streaming"

Type guard

def is_causal_video_vae(vae) -> bool:
    return hasattr(vae, "decode_chunk")

Try / catch

null

Prevention

When it happens

Trigger: Launching a streaming SANA-WM pipeline with the default/non-causal VAE weights, or a component override that swapped in a generic AutoencoderKL.

Common situations: Reusing a dense-path config (standard VAE) for streaming; missing ltx2_causal_vae checkpoint locally so a fallback VAE loaded; typo in --component_paths.vae path silently falling back.

Related errors


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