sgl-project/sglang · critical · ValueError

aligned video noise shape {list(video_noise.shape)} != [{vid

Error message

aligned video noise shape {list(video_noise.shape)} != [{video_rows_n}, 96]

What it means

The stage generates aligned video noise internally and asserts its shape equals [video_rows_n, 96] (96 latent channels). A mismatch means the noise-producing code path returned an unexpected layout — almost always a bug or version skew inside the noise generation helper, not user input.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/latent_preparation.py:130

        gen_v = torch.Generator().manual_seed(int(seed))
        video_tensor = torch.randn(
            1,
            24,
            latent_t,
            latent_h,
            latent_w,
            generator=gen_v,
            dtype=torch.float32,
        )
        video_noise = minimax_h3_patchify_video_latent(
            video_tensor, patch_size=[1, 2, 2]
        ).to(torch.float32)
        gen_a = torch.Generator().manual_seed(int(seed))
        audio_noise = torch.randn(
            audio_rows_n, 32, generator=gen_a, dtype=torch.float32
        )
        if list(video_noise.shape) != [video_rows_n, 96]:
            raise ValueError(
                f"aligned video noise shape {list(video_noise.shape)} != "
                f"[{video_rows_n}, 96]"
            )
        batch.extra[MINIMAX_H3_DENOISE_STATE_EXTRA_KEY] = {
            "initial_video_rows": video_noise,
            "initial_audio_rows": audio_noise,
            "latent_t": latent_t,
            "latent_h": latent_h,
            "latent_w": latent_w,
            "audio_t": audio_t,
        }

    def verify_input(self, batch: Req, server_args: ServerArgs) -> VerificationResult:
        result = VerificationResult()
        result.add_check(
            "prompt_or_embeds",
            None,
            lambda _: V.string_or_list_strings(batch.prompt)

View on GitHub (pinned to 0132848349)

Solutions

  1. Ensure the noise generation helper used by this stage matches its expected [rows, 96] contract (update the module/package to a consistent version)
  2. Verify video_rows_n is computed from the same latent_t*latent_h*latent_w formula the noise generator uses
  3. Report as an internal invariant break if versions are consistent
Defensive patterns

Strategy: try-catch

Try / catch

try:
    stage.forward(batch)
except ValueError as e:
    if "aligned video noise shape" in str(e):
        raise RuntimeError("noise generator / stage version skew; realign packages") from e
    raise

Prevention

When it happens

Trigger: _prepare_denoise_state_from_plan computes video_noise whose list(shape) != [video_rows_n, 96], e.g. an older noise generator emitting a different channel count, or video_rows_n derived inconsistently from latent_t/latent_h/latent_w.

Common situations: Mixing versions of the minimax_h3 stage module and its noise-generation helper, monkey-patched noise code, or an upstream refactor that changed the latent channel dimension.

Related errors


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