sgl-project/sglang · error · ValueError

quantized tensor maps to a non-weight parameter: {tensor.nam

Error message

quantized tensor maps to a non-weight parameter: {tensor.name}

What it means

While yielding quantized weight metadata for DeepSeek GGUF expert-pack loading, a GGUF tensor mapped to a checkpoint name that doesn't end in '.weight'. Since only real weight parameters should carry a qweight_type entry, the loader raises ValueError to flag a mis-mapped tensor (e.g. mapped onto a bias, norm, or malformed name).

Source

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

    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:
        if routed_expert_tensor(tensor.name) is not None:
            continue
        weight_type = tensor.tensor_type
        if weight_type.name == "Q8_0":
            component = _compressor_component(tensor.name)
            if component == "gate":
                continue
            checkpoint_name = (
                _fused_compressor_name(mapping[tensor.name])
                if component == "kv"
                else mapping[tensor.name]
            )
            if not checkpoint_name.endswith(".weight"):
                raise ValueError(
                    f"quantized tensor maps to a non-weight parameter: {tensor.name}"
                )
            yield (
                checkpoint_name.removesuffix("weight") + "qweight_type",
                torch.tensor(int(weight_type), dtype=torch.uint8),
            )

    for tensor in reader.tensors:
        if routed_expert_tensor(tensor.name) is not None:
            continue
        checkpoint_name = mapping[tensor.name]
        weight_type = tensor.tensor_type
        if weight_type.name == "Q8_0":
            component = _compressor_component(tensor.name)
            if component == "gate":
                continue
            if component == "kv":
                gate_name = tensor.name.replace("_compressor_kv", "_compressor_gate")

View on GitHub (pinned to 0132848349)

Solutions

  1. Log/inspect tensor.name and its mapped checkpoint_name to see what it resolved to
  2. Pin the gguf package version compatible with this sglang release
  3. Re-convert weights to GGUF using a converter matched to your sglang version
  4. Upgrade sglang if newer GGUF quantized naming schemes are supported
Defensive patterns

Strategy: validation

Validate before calling

assert checkpoint_name.endswith('.weight'), (
    f'quantized tensor maps to non-weight param: {checkpoint_name}')

Type guard

def is_weight_param_name(name: str) -> bool:
    return name.endswith('.weight')

Prevention

When it happens

Trigger: Calling load_model via deepseek4_nonexpert_weights_iterator where a quantized tensor's resolved checkpoint_name lacks the '.weight' suffix — usually because the name map returned a '.bias'/'.norm' style name or a truncated/renamed key.

Common situations: GGUF name map drift across gguf package versions, quantized GGUF conversions with suffixed names (.weight_scale_and_zero, .qweight), or an alias collision in the mapping.

Related errors


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