{"record":{"id":"0c7dc305cac24ea6","repo":"sgl-project/sglang","slug":"weight-name-not-found-in-params-dict-0c7dc3","errorCode":null,"errorMessage":"Weight {name} not found in params_dict","messagePattern":"Weight (.+?) not found in params_dict","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/models/step3_vl_10b.py","lineNumber":622,"sourceCode":"        for name, loaded_weight in weights:\n            if \"vision_model\" in name or \"vit_large_projector\" in name:\n                name = name.replace(r\".attn.in_proj_weight\", r\".attn.qkv_proj.weight\")\n                name = name.replace(r\".attn.in_proj_bias\", r\".attn.qkv_proj.bias\")\n                name = name.replace(r\".attn.out_proj.bias\", r\".attn.proj.bias\")\n                name = name.replace(r\".attn.out_proj.weight\", r\".attn.proj.weight\")\n                name = name.replace(\".mlp.c_fc\", \".mlp.fc1\")\n                name = name.replace(\".mlp.c_proj\", \".mlp.fc2\")\n                vision_weights.append((name, loaded_weight))\n            else:\n                # All other weights go to language model\n                language_weights.append((name, loaded_weight))\n\n        # Load vision tower weights\n        vision_state_dict = dict(vision_weights)\n        params_dict = dict(self.named_parameters(remove_duplicate=False))\n        for name, loaded_weight in vision_state_dict.items():\n            if name not in params_dict:\n                raise ValueError(f\"Weight {name} not found in params_dict\")\n            param = params_dict[name]\n            weight_loader = getattr(param, \"weight_loader\", default_weight_loader)\n            # loaded_weight = self._pad_vit_attn_dummy_heads(name, loaded_weight)\n            weight_loader(param, loaded_weight)\n\n        # Load language model weights\n        if language_weights:\n            self.language_model.load_weights(language_weights)\n\n\nEntryClass = StepVLForConditionalGeneration\n","sourceCodeStart":604,"sourceCodeEnd":634,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/step3_vl_10b.py#L604-L634","documentation":"During checkpoint loading, the Step3 VL vision-tower weight loop iterates over every key in the checkpoint's vision state dict and requires each to exist in the model's named_parameters. If the checkpoint contains a vision key that the instantiated model did not create (name mismatch, refactor, or extra keys), loading aborts.","triggerScenarios":"Loading a Step3-VL-10B checkpoint whose vision tower parameter names differ from the model definition (e.g. renamed ViT modules, dummy-head padding disabled, or a checkpoint from a different revision).","commonSituations":"Model file revision mismatch with checkpoint, sharded safetensors containing stale vision keys, or code refactors that renamed vision tower modules.","solutions":["Print/diff set(vision_state_dict) vs set(params_dict) to find the offending key","Verify the checkpoint matches the model architecture/revision in this repo","Update the name mapping/filtering in load_weights for known-renamed vision weights","Ensure the correct config (vision_config) is passed so the same modules are built"],"exampleFix":"// before\nif name not in params_dict:\n    raise ValueError(f\"Weight {name} not found in params_dict\")\n// after (skip known-stale keys)\nSKIP = {\"vision_tower.old_key\"}\nif name not in params_dict:\n    if name in SKIP:\n        continue\n    raise ValueError(f\"Weight {name} not found in params_dict\")","handlingStrategy":"validation","validationCode":"missing = set(vision_state_dict) - set(dict(model.named_parameters(remove_duplicate=False)))\nassert not missing, f\"unmapped vision keys: {missing}\"","typeGuard":null,"tryCatchPattern":"try:\n    model.load_weights(weights)\nexcept ValueError as e:\n    if 'not found in params_dict' in str(e):\n        raise RuntimeError(f\"checkpoint/model skew: {e}\") from e\n    raise","preventionTips":["Pin checkpoint and model revisions together","Run a key-diff smoke test before serving","Add unit tests loading a tiny checkpoint fixture"],"tags":["checkpoint-loading","vision-tower","weight-mapping"],"backgroundTag":"checkpoint-key-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}