| 123456789101112131415161718192021222324252627282930313233343536 |
- --- a/vllm/model.py
- +++ b/vllm/model.py
- @@ -770,6 +770,33 @@
- for args in weights:
- name, loaded_weight = args[:2]
- kwargs: dict = args[2] if len(args) > 2 else {}
- + # Checkpoint layout shim (NVFP4 export uses newer serialization):
- + # renames verified shape/byte-equivalent against the fp8 export.
- + for _hc_from, _hc_to in (
- + ("attn_hc.base", "hc_attn_base"),
- + ("attn_hc.fn", "hc_attn_fn"),
- + ("attn_hc.scale", "hc_attn_scale"),
- + ("ffn_hc.base", "hc_ffn_base"),
- + ("ffn_hc.fn", "hc_ffn_fn"),
- + ("ffn_hc.scale", "hc_ffn_scale"),
- + (".self_attn.forget_gate.A_log", ".self_attn.A_log"),
- + (".self_attn.forget_gate.dt_bias", ".self_attn.dt_bias"),
- + (".self_attn.forget_gate.f_a_proj.", ".self_attn.f_a_proj."),
- + (".self_attn.forget_gate.f_b_proj.", ".self_attn.f_b_proj."),
- + ):
- + if _hc_from in name:
- + name = name.replace(_hc_from, _hc_to)
- + break
- + # Fused linear-attn conv: split [3*C,1,4] into q/k/v convs.
- + if ".self_attn.conv1d.weight" in name:
- + _c = loaded_weight.shape[0] // 3
- + for _j, _nm in enumerate(("q_conv1d", "k_conv1d", "v_conv1d")):
- + _sub = name.replace(".conv1d.weight", ".%s.weight" % _nm)
- + _p = params_dict[_sub]
- + _wl = getattr(_p, "weight_loader", default_weight_loader)
- + _wl(_p, loaded_weight[_j * _c : (_j + 1) * _c])
- + loaded_params.add(_sub)
- + continue
- if "rotary_emb.inv_freq" in name:
- continue
-
|