[Bugfix] MiniCPM-V 4.6: fix ViT self-attn qkv weight loading (#49417)

Signed-off-by: arkohut <39525455+arkohut@users.noreply.github.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

arkohut committed Sep 14, 2026 at 21:18 UTC 6623fe5b4ec783e7264f140e0caea20bdc45a341
1 file changed +6 -13
vllm/model_executor/models/minicpmv4_6.py
+6 -13
@@ -674,14 +674,6 @@ class MiniCPMV4_6ProcessingInfo(MiniCPMVProcessingInfo):
674
675
676 class MiniCPMV4_6ViTWindowAttentionSelfAttn(nn.Module):
677 - hf_to_vllm_mapper = WeightsMapper(
678 - orig_to_new_stacked={
679 - ".q_proj": (".qkv_proj", "q"),
680 - ".k_proj": (".qkv_proj", "k"),
681 - ".v_proj": (".qkv_proj", "v"),
682 - }
683 - )
684 -
677 def __init__(
678 self,
679 config,
@@ -729,10 +721,6 @@ class MiniCPMV4_6ViTWindowAttentionSelfAttn(nn.Module):
721 out, _ = self.out_proj(attn_out)
722 return out
723
732 - def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
733 - loader = AutoWeightsLoader(self)
734 - return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
735 -
724
725 class MiniCPMV4_6ViTWindowAttentionMerger(nn.Module):
726 def __init__(
@@ -971,6 +959,11 @@ class MiniCPMV4_6ForConditionalGeneration(
959 supports_encoder_tp_data = True
960
961 hf_to_vllm_mapper = WeightsMapper(
962 + orig_to_new_stacked={
963 + ".q_proj": (".qkv_proj", "q"),
964 + ".k_proj": (".qkv_proj", "k"),
965 + ".v_proj": (".qkv_proj", "v"),
966 + },
967 orig_to_new_prefix={
968 # transformers v5.7+ uses `vision_tower` and nests `vit_merger`
969 # inside it. Order matters: more specific prefix must come first.
@@ -982,7 +975,7 @@ class MiniCPMV4_6ForConditionalGeneration(
975 "model.language_model.": "language_model.model.",
976 "lm_head.": "language_model.lm_head.",
977 "mtp.": None,
985 - }
978 + },
979 )
980
981 packed_modules_mapping = {