{"record":{"id":"46f2e5227fc2b21f","repo":"sgl-project/sglang","slug":"cannot-resolve-deferred-scale-inv-scale-name-we","errorCode":null,"errorMessage":"Cannot resolve deferred scale_inv {scale_name}: weight {weight_name} not found","messagePattern":"Cannot resolve deferred scale_inv (.+?): weight (.+?) not found","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/mimo_v2.py","lineNumber":203,"sourceCode":"    return torch.cat(all_q + all_k + all_v, dim=0)\n\n\ndef _resolve_deferred_qkv_scale_inv(\n    params_dict: Dict[str, torch.nn.Parameter],\n    deferred_scale_inv: Dict[str, torch.Tensor],\n    expected_fused_tp_size: int,\n    block_size: int = 128,\n    config=None,\n):\n    tp_size = get_parallel().attn_tp_size\n    tp_rank = get_parallel().attn_tp_rank\n    ckpt_tp = expected_fused_tp_size\n    shards_per_rank = ckpt_tp // tp_size\n\n    for scale_name, ckpt_scale in deferred_scale_inv.items():\n        weight_name = scale_name.replace(\".weight_scale_inv\", \".weight\")\n        if weight_name not in params_dict:\n            raise ValueError(\n                f\"Cannot resolve deferred scale_inv {scale_name}: \"\n                f\"weight {weight_name} not found\"\n            )\n\n        weight_param = params_dict[weight_name]\n        scale_param = params_dict[scale_name]\n        weight_data = weight_param.data\n\n        ckpt_scale_shards = ckpt_scale.chunk(ckpt_tp, dim=0)\n        my_scale_shards = ckpt_scale_shards[\n            tp_rank * shards_per_rank : (tp_rank + 1) * shards_per_rank\n        ]\n\n        weight_rows = weight_data.shape[0]\n        rows_per_ckpt_shard = weight_rows // shards_per_rank\n        block_k = ckpt_scale.shape[1]\n\n        device = weight_data.device","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/mimo_v2.py#L185-L221","documentation":"During deferred scale_inv resolution, the corresponding .weight parameter derived by replacing '.weight_scale_inv' with '.weight' is not present in params_dict. The deferred scale was captured but has no matching parameter to size against.","triggerScenarios":"A scale_name stored in deferred_scale_inv whose sibling weight tensor is absent from params_dict — either the weight was skipped/renamed, or the param mapping (name replace) doesn't match the model's parameter naming.","commonSituations":"Custom quantized checkpoint names that don't follow 'model.layers.X.self_attn.qkv_proj.weight[_scale_inv]' convention; partial checkpoints; renaming during conversion.","solutions":["Ensure every weight_scale_inv tensor has a matching .weight tensor with the same name in the checkpoint","Verify parameter names in the converted checkpoint match the model's params_dict keys (qkv_proj naming)","Drop orphan scale_inv tensors during conversion if their weights are intentionally absent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"missing = [s for s in deferred if s.replace('.weight_scale_inv', '.weight') not in params_dict]\nif missing:\n    raise SystemExit(f'orphan scale_inv tensors: {missing}')","typeGuard":"def scale_has_weight(scale_name: str, params_dict: dict) -> bool:\n    return scale_name.replace('.weight_scale_inv', '.weight') in params_dict","tryCatchPattern":null,"preventionTips":["Keep weight and weight_scale_inv naming symmetric during conversion","Filter checkpoint tensors to those matching model parameter names before loading"],"tags":["quantization","weight-loading","naming","mimo"],"backgroundTag":"missing-checkpoint-tensor","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}