{"record":{"id":"01cf206c544a7940","repo":"sgl-project/sglang","slug":"deepseek-v4-gguf-mapping-collision-other-r-and","errorCode":null,"errorMessage":"DeepSeek-V4 GGUF mapping collision: {other!r} and {tensor_name!r} -> {checkpoint_name!r}","messagePattern":"DeepSeek-V4 GGUF mapping collision: (.+?) and (.+?) -> (.+?)","errorType":"panic","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/model_loader/deepseek4_gguf.py","lineNumber":168,"sourceCode":"    reverse: dict[str, str] = {}\n    missing: list[str] = []\n    for tensor_name in tensor_names:\n        checkpoint_name = _v4_checkpoint_name(tensor_name)\n        if checkpoint_name is None:\n            base, suffix = _split_suffix(tensor_name)\n            candidates = aliases_by_gguf_base.get(base, ())\n            if candidates:\n                alias = min(candidates, key=_candidate_score)\n                checkpoint_name = alias\n                if suffix and not alias.endswith(f\".{suffix}\"):\n                    checkpoint_name += f\".{suffix}\"\n\n        if checkpoint_name is None:\n            missing.append(tensor_name)\n            continue\n        if checkpoint_name in reverse:\n            other = reverse[checkpoint_name]\n            raise RuntimeError(\n                \"DeepSeek-V4 GGUF mapping collision: \"\n                f\"{other!r} and {tensor_name!r} -> {checkpoint_name!r}\"\n            )\n        result[tensor_name] = checkpoint_name\n        reverse[checkpoint_name] = tensor_name\n\n    if missing:\n        preview = \", \".join(repr(name) for name in missing[:8])\n        raise RuntimeError(\n            f\"No DeepSeek-V4 checkpoint mapping for {len(missing)} GGUF tensors: \"\n            f\"{preview}\"\n        )\n    return result\n","sourceCodeStart":150,"sourceCodeEnd":182,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/model_loader/deepseek4_gguf.py#L150-L182","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pin the gguf version known to work with this sglang release (check sglang's requirement pin)","Upgrade (or downgrade) gguf to the version whose DEEPSEEK2 name map matches; inspect gguf.get_tensor_name_map output for the reported tensor names","If using a custom-converted GGUF, re-convert with an official/compatible convert script","Report the collision pair from the error message upstream with gguf and sglang versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import gguf\nname_map = gguf.get_tensor_name_map(gguf.MODEL_ARCH.DEEPSEEK2, num_layers)\nreverse = {}\nfor alias, m in name_map.mapping.items():\n    if m.name in reverse:\n        print('collision:', reverse[m.name], alias, '->', m.name)\n    reverse[m.name] = alias","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the gguf version validated for your sglang release in requirements.txt","Smoke-test GGUF loading on new model files before production","Report name-map collisions with the exact tensor names to maintainers"],"tags":["gguf","deepseek","name-collision","weight-mapping"],"backgroundTag":"tensor-name-collision","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}