sgl-project/sglang · error · ValueError

invalid compressor checkpoint name: {checkpoint_name}

Error message

invalid compressor checkpoint name: {checkpoint_name}

What it means

_fused_compressor_name expects a compressor checkpoint name containing '.wkv.weight' or '.wgate.weight' and rewrites it to the fused '.wkv_gate.weight' parameter. If neither substring is present the name is unchanged and ValueError is raised, meaning the caller passed a tensor name that isn't a recognized compressor KV/gate weight.

Source

Thrown at python/sglang/srt/model_loader/expert_pack_loader.py:69

    if raw.dtype != np.uint8 or raw.shape[-1] % 2:
        raise ValueError("GGUF BF16 payload does not have a byte-pair layout")
    values = raw.view(np.uint16).reshape(*raw.shape[:-1], raw.shape[-1] // 2)
    return torch.from_numpy(values.copy()).view(torch.bfloat16)


def _compressor_component(source_name: str) -> str | None:
    if "_compressor_kv.weight" in source_name:
        return "kv"
    if "_compressor_gate.weight" in source_name:
        return "gate"
    return None


def _fused_compressor_name(checkpoint_name: str) -> str:
    result = checkpoint_name.replace(".wkv.weight", ".wkv_gate.weight")
    result = result.replace(".wgate.weight", ".wkv_gate.weight")
    if result == checkpoint_name:
        raise ValueError(f"invalid compressor checkpoint name: {checkpoint_name}")
    return result


def deepseek4_nonexpert_weights_iterator(
    source_path: str | os.PathLike[str],
    num_layers: int,
) -> Generator[Tuple[str, torch.Tensor], None, None]:
    """Yield exact non-routed tensors without materializing routed experts."""

    import gguf

    reader = gguf.GGUFReader(str(source_path), mode="r")
    names = [tensor.name for tensor in reader.tensors]
    mapping = build_deepseek4_checkpoint_name_map(gguf, names, num_layers)
    tensors = {tensor.name: tensor for tensor in reader.tensors}

    # GGUF quant methods must know the type before the raw qweight arrives.
    for tensor in reader.tensors:

View on GitHub (pinned to 0132848349)

Solutions

  1. Inspect the failing checkpoint_name in the message and compare with the expected compressor naming (model.layers.N....wkv.weight / .wgate.weight)
  2. Align gguf package and sglang versions so the name map yields expected suffixes
  3. If loading a quantized compressor variant, use a loader path that supports it or dequantize first
  4. Re-convert the GGUF with a compatible converter so names keep the .wkv/.wgate convention
Defensive patterns

Strategy: validation

Validate before calling

def is_compressor_checkpoint_name(name: str) -> bool:
    return '.wkv.weight' in name or '.wgate.weight' in name
assert is_compressor_checkpoint_name(mapped_name), f'unexpected compressor name: {mapped_name}'

Type guard

def is_fusable_compressor_name(name: str) -> bool:
    return '.wkv.weight' in name or '.wgate.weight' in name

Prevention

When it happens

Trigger: deepseek4_nonexpert_weights_iterator processing a tensor whose source name matched the compressor-kv detector (contains '_compressor_kv.weight') but whose mapped checkpoint name contains neither .wkv.weight nor .wgate.weight — e.g. due to name map drift or unexpected quantized suffixes like .wkv.qweight.

Common situations: gguf name-map version skew producing unexpected checkpoint names, quantized GGUF variants with altered suffixes (qweight/weight_format), or model conversions that rename compressor weights.

Related errors


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