sgl-project/sglang · error · ValueError

MiniMax-H3 adaln_t_table must have shape [N, D] with N >= 2,

Error message

MiniMax-H3 adaln_t_table must have shape [N, D] with N >= 2, got {shape} in {path}

What it means

inspect_minimax_h3_safetensors uses the 'adaln_t_table' tensor both to detect MiniMax-H3 checkpoints and to derive the adaptive-layer-norm curve. It requires the table to be a 2D tensor whose first dimension (number of curve points N) is at least 2; otherwise the shape is unusable for curve interpolation and the file is rejected.

Source

Thrown at python/sglang/multimodal_gen/runtime/loader/minimax_h3_weights.py:38

def comfy_quant_key_filter(name: str) -> bool:
    return not name.endswith(".comfy_quant")


def inspect_minimax_h3_safetensors(
    safetensors_list: list[str],
) -> tuple[tuple[int, int] | None, dict[str, dict[str, Any]]]:
    """Read H3 architecture metadata and Comfy per-layer format markers."""
    adaln_curve_shape = None
    layer_markers = inspect_comfy_quant_markers(safetensors_list)

    for path in safetensors_list:
        with safe_open(path, framework="pt", device="cpu") as checkpoint:
            keys = checkpoint.keys()
            if "adaln_t_table" in keys:
                shape = tuple(checkpoint.get_slice("adaln_t_table").get_shape())
                if len(shape) != 2 or shape[0] < 2:
                    raise ValueError(
                        "MiniMax-H3 adaln_t_table must have shape [N, D] with "
                        f"N >= 2, got {shape} in {path}"
                    )
                if adaln_curve_shape is not None and adaln_curve_shape != shape:
                    raise ValueError(
                        "MiniMax-H3 checkpoint shards disagree on adaln_t_table "
                        f"shape: {adaln_curve_shape} vs {shape}"
                    )
                adaln_curve_shape = shape

    return adaln_curve_shape, layer_markers


def resolve_minimax_h3_checkpoint_quantization(
    layer_markers: dict[str, dict[str, Any]],
    safetensors_list: list[str] | None = None,
    param_names_mapping: dict | None = None,
    reverse_param_names_mapping: dict | None = None,

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-download or re-export the MiniMax-H3 checkpoint so adaln_t_table is a complete [N, D] table with N >= 2
  2. Verify the tensor with safetensors' get_slice before loading: shape must be 2D with shape[0] >= 2
  3. If the key is spurious (non-MiniMax checkpoint), remove it or point the loader at the correct checkpoint

Example fix

# before: adaln_t_table shape (1, 1152) -> raise
# after: shape (256, 1152) -> valid curve table
from safetensors import safe_open
with safe_open(path, framework='pt') as f:
    assert tuple(f.get_slice('adaln_t_table').get_shape())[0] >= 2
Defensive patterns

Strategy: validation

Validate before calling

from safetensors import safe_open
with safe_open(path, framework='pt') as f:
    if 'adaln_t_table' in f.keys():
        s = tuple(f.get_slice('adaln_t_table').get_shape())
        assert len(s) == 2 and s[0] >= 2, f'bad adaln_t_table {s} in {path}'

Type guard

def is_valid_adaln_table(shape: tuple) -> bool:
    return len(shape) == 2 and shape[0] >= 2

Prevention

When it happens

Trigger: Calling load_customized (or inspect_minimax_h3_safetensors) on safetensors shards where 'adaln_t_table' exists but has rank != 2 or shape[0] < 2 — e.g. a 1D table or a single-row [1, D] table.

Common situations: Corrupted or truncated MiniMax-H3 safetensors exports; a checkpoint from a different model family that happens to contain an 'adaln_t_table' key; partial shards where only a fragment of the table was saved.

Related errors


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