sgl-project/sglang · error · ValueError

MOVA requires reference image latents for denoising

Error message

MOVA requires reference image latents for denoising

What it means

The MOVA latent-preparation stage needs a reference image latent (batch.y) to condition denoising when the video DiT is configured with require_vae_embedding. If batch.image_latent is None and the model requires VAE embeddings, no conditioning signal exists and the stage refuses to proceed.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/mova.py:124

        generator = batch.generator
        if isinstance(generator, list) and len(generator) != batch_size:
            raise ValueError(
                f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
                f" size of {batch_size}. Make sure the batch size matches the length of the generators."
            )

        dit_dtype = PRECISION_TO_TYPE[server_args.pipeline_config.dit_precision]
        batch.latents = randn_tensor(
            video_shape, generator=generator, device=device, dtype=dit_dtype
        )
        batch.audio_latents = randn_tensor(
            audio_shape, generator=generator, device=device, dtype=dit_dtype
        )

        if batch.image_latent is not None:
            batch.y = batch.image_latent.to(device=device, dtype=dit_dtype)
        elif self.require_vae_embedding:
            raise ValueError("MOVA requires reference image latents for denoising")
        return batch


class MOVATimestepPreparationStage(PipelineStage):
    """Prepare paired timesteps for MOVA."""

    def __init__(self, scheduler) -> None:
        super().__init__()
        self.scheduler = scheduler

    def forward(self, batch: Req, server_args: ServerArgs) -> Req:
        scheduler = self.scheduler
        scheduler.set_timesteps(
            batch.num_inference_steps,
            denoising_strength=1.0,
            shift=getattr(batch, "sigma_shift", scheduler.shift),
        )
        scheduler.set_pair_postprocess_by_name(

View on GitHub (pinned to 0132848349)

Solutions

  1. Provide a reference image for the request so the upstream stage populates batch.image_latent
  2. Check the upstream VAE encoding stage ran and its output was attached to batch.image_latent
  3. If unconditional generation is intended, use a model/config where require_vae_embedding is False
Defensive patterns

Strategy: validation

Validate before calling

if getattr(model, 'require_vae_embedding', False):
    if batch.image_latent is None:
        raise ValueError('reference image required for this MOVA config — attach one before forward')

Type guard

def has_reference_latent(batch) -> bool:
    return batch.y is not None or batch.image_latent is not None

Try / catch

try:
    stage.forward(batch)
except ValueError as e:
    if 'reference image latents' in str(e):
        return error_response('image-to-video requires a reference image')
    raise

Prevention

When it happens

Trigger: Running the MOVA pipeline with a video DiT whose require_vae_embedding attribute is truthy while the incoming batch carries image_latent=None (no reference image was VAE-encoded upstream).

Common situations: Image-to-video request submitted without a reference image, an upstream VAE-encode stage skipped or failed silently, or image conditioning accidentally disabled in the pipeline config.

Related errors


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