From: Xuan-Son Nguyen Date: Wed, 28 May 2025 08:05:54 +0000 (+0200) Subject: convert : fix tensor naming conflict for llama 4 vision (#13836) X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=26b79b6cb3e7840ff15729350e95907e19f9f480;p=pkg%2Fggml%2Fsources%2Fllama.cpp convert : fix tensor naming conflict for llama 4 vision (#13836) * convert : fix tensor naming conflict for llama 4 vision * add comment --- diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index a015ecee..7f935d09 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -2169,6 +2169,9 @@ class Llama4VisionModel(MmprojModel): # process vision tensors if "positional_embedding_vlm" in name and ".weight" not in name: name += ".weight" + if "multi_modal_projector.linear_1" in name: + # despite the name with number postfix, this is a single fully connected layer + return [(gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_MMPROJ_FC], data_torch)] return [(self.map_tensor_name(name), data_torch)] return [] diff --git a/gguf-py/gguf/tensor_mapping.py b/gguf-py/gguf/tensor_mapping.py index 000ffd00..48167dd6 100644 --- a/gguf-py/gguf/tensor_mapping.py +++ b/gguf-py/gguf/tensor_mapping.py @@ -902,7 +902,6 @@ class TensorNameMap: MODEL_TENSOR.V_MMPROJ_FC: ( "model.connector.modality_projection.proj", # SmolVLM - "multi_modal_projector.linear_1", # llama 4 ), MODEL_TENSOR.V_MMPROJ_MLP: (