sgl-project/sglang · error · RuntimeError

DeepSeek-V4 GGUF mapping collision: {other!r} and {tensor_na

Error message

DeepSeek-V4 GGUF mapping collision: {other!r} and {tensor_name!r} -> {checkpoint_name!r}

What it means

While building the GGUF->checkpoint tensor name map for DeepSeek-V4, two distinct GGUF tensor names resolved to the same checkpoint parameter name, so the mapping is ambiguous and would silently drop one tensor. The loader raises RuntimeError naming both colliding sources and the shared target rather than risk incorrect weight loading.

Source

Thrown at python/sglang/srt/model_loader/deepseek4_gguf.py:168

    reverse: dict[str, str] = {}
    missing: list[str] = []
    for tensor_name in tensor_names:
        checkpoint_name = _v4_checkpoint_name(tensor_name)
        if checkpoint_name is None:
            base, suffix = _split_suffix(tensor_name)
            candidates = aliases_by_gguf_base.get(base, ())
            if candidates:
                alias = min(candidates, key=_candidate_score)
                checkpoint_name = alias
                if suffix and not alias.endswith(f".{suffix}"):
                    checkpoint_name += f".{suffix}"

        if checkpoint_name is None:
            missing.append(tensor_name)
            continue
        if checkpoint_name in reverse:
            other = reverse[checkpoint_name]
            raise RuntimeError(
                "DeepSeek-V4 GGUF mapping collision: "
                f"{other!r} and {tensor_name!r} -> {checkpoint_name!r}"
            )
        result[tensor_name] = checkpoint_name
        reverse[checkpoint_name] = tensor_name

    if missing:
        preview = ", ".join(repr(name) for name in missing[:8])
        raise RuntimeError(
            f"No DeepSeek-V4 checkpoint mapping for {len(missing)} GGUF tensors: "
            f"{preview}"
        )
    return result

View on GitHub (pinned to 0132848349)

Solutions

  1. Pin the gguf version known to work with this sglang release (check sglang's requirement pin)
  2. Upgrade (or downgrade) gguf to the version whose DEEPSEEK2 name map matches; inspect gguf.get_tensor_name_map output for the reported tensor names
  3. If using a custom-converted GGUF, re-convert with an official/compatible convert script
  4. Report the collision pair from the error message upstream with gguf and sglang versions
Defensive patterns

Strategy: validation

Validate before calling

import gguf
name_map = gguf.get_tensor_name_map(gguf.MODEL_ARCH.DEEPSEEK2, num_layers)
reverse = {}
for alias, m in name_map.mapping.items():
    if m.name in reverse:
        print('collision:', reverse[m.name], alias, '->', m.name)
    reverse[m.name] = alias

Prevention

When it happens

Trigger: Calling build_deepseek4_checkpoint_name_map (via deepseek4_nonexpert_weights_iterator) with a gguf package whose DeepSeek2 name map maps two GGUF tensor keys (e.g. two compressor/attention aliases) to the same checkpoint name for the given num_layers.

Common situations: A newer/older gguf release changed the DeepSeek name map (added aliases) so two entries now collide with sglang's expectations, or a nonstandard GGUF conversion produced duplicate-mapped tensors.

Related errors


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