sgl-project/sglang · critical · ValueError

Weight {name} not found in params_dict

Error message

Weight {name} not found in params_dict

What it means

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.

Source

Thrown at python/sglang/srt/models/step3_vl_10b.py:622

        for name, loaded_weight in weights:
            if "vision_model" in name or "vit_large_projector" in name:
                name = name.replace(r".attn.in_proj_weight", r".attn.qkv_proj.weight")
                name = name.replace(r".attn.in_proj_bias", r".attn.qkv_proj.bias")
                name = name.replace(r".attn.out_proj.bias", r".attn.proj.bias")
                name = name.replace(r".attn.out_proj.weight", r".attn.proj.weight")
                name = name.replace(".mlp.c_fc", ".mlp.fc1")
                name = name.replace(".mlp.c_proj", ".mlp.fc2")
                vision_weights.append((name, loaded_weight))
            else:
                # All other weights go to language model
                language_weights.append((name, loaded_weight))

        # Load vision tower weights
        vision_state_dict = dict(vision_weights)
        params_dict = dict(self.named_parameters(remove_duplicate=False))
        for name, loaded_weight in vision_state_dict.items():
            if name not in params_dict:
                raise ValueError(f"Weight {name} not found in params_dict")
            param = params_dict[name]
            weight_loader = getattr(param, "weight_loader", default_weight_loader)
            # loaded_weight = self._pad_vit_attn_dummy_heads(name, loaded_weight)
            weight_loader(param, loaded_weight)

        # Load language model weights
        if language_weights:
            self.language_model.load_weights(language_weights)


EntryClass = StepVLForConditionalGeneration

View on GitHub (pinned to 0132848349)

Solutions

  1. Print/diff set(vision_state_dict) vs set(params_dict) to find the offending key
  2. Verify the checkpoint matches the model architecture/revision in this repo
  3. Update the name mapping/filtering in load_weights for known-renamed vision weights
  4. Ensure the correct config (vision_config) is passed so the same modules are built

Example fix

// before
if name not in params_dict:
    raise ValueError(f"Weight {name} not found in params_dict")
// after (skip known-stale keys)
SKIP = {"vision_tower.old_key"}
if name not in params_dict:
    if name in SKIP:
        continue
    raise ValueError(f"Weight {name} not found in params_dict")
Defensive patterns

Strategy: validation

Validate before calling

missing = set(vision_state_dict) - set(dict(model.named_parameters(remove_duplicate=False)))
assert not missing, f"unmapped vision keys: {missing}"

Try / catch

try:
    model.load_weights(weights)
except ValueError as e:
    if 'not found in params_dict' in str(e):
        raise RuntimeError(f"checkpoint/model skew: {e}") from e
    raise

Prevention

When it happens

Trigger: 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).

Common situations: Model file revision mismatch with checkpoint, sharded safetensors containing stale vision keys, or code refactors that renamed vision tower modules.

Related errors


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