Skip to content

Commit c030984

Browse files
committed
move V_ENC_EMBD_PATCH handling to Qwen2VLVisionModel
1 parent 62b7b1e commit c030984

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

convert_hf_to_gguf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,8 +2653,8 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
26532653
del c1, c2, kh, kw # unused
26542654
assert kt == 2, "Current implmentation only support temporal_patch_size of 2"
26552655
return [
2656-
(self.map_tensor_name(name), data_torch[:, :, 0, ...]),
2657-
(self.map_tensor_name(name + '.1'), data_torch[:, :, 1, ...]),
2656+
(gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_ENC_EMBD_PATCH] + ".weight" , data_torch[:, :, 0, ...]),
2657+
(gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_ENC_EMBD_PATCH] + ".weight.1", data_torch[:, :, 1, ...]),
26582658
]
26592659
else:
26602660
return [(self.map_tensor_name(name), data_torch)]

gguf-py/gguf/constants.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ class MODEL_TENSOR(IntEnum):
481481
V_MMPROJ_PEG = auto()
482482
V_ENC_EMBD_CLS = auto()
483483
V_ENC_EMBD_PATCH = auto()
484-
V_ENC_EMBD_PATCH1 = auto() # qwen2vl
485484
V_ENC_EMBD_POS = auto()
486485
V_ENC_ATTN_Q = auto()
487486
V_ENC_ATTN_K = auto()
@@ -739,7 +738,6 @@ class MODEL_TENSOR(IntEnum):
739738
MODEL_TENSOR.V_MMPROJ_PEG: "mm.model.peg.{bid}",
740739
MODEL_TENSOR.V_ENC_EMBD_CLS: "v.class_embd",
741740
MODEL_TENSOR.V_ENC_EMBD_PATCH: "v.patch_embd",
742-
MODEL_TENSOR.V_ENC_EMBD_PATCH1: "v.patch_embd.weight.1", # qwen2vl
743741
MODEL_TENSOR.V_ENC_EMBD_POS: "v.position_embd",
744742
MODEL_TENSOR.V_ENC_ATTN_Q: "v.blk.{bid}.attn_q",
745743
MODEL_TENSOR.V_ENC_ATTN_K: "v.blk.{bid}.attn_k",
@@ -778,7 +776,6 @@ class MODEL_TENSOR(IntEnum):
778776
MODEL_TENSOR.V_MMPROJ_PEG,
779777
MODEL_TENSOR.V_ENC_EMBD_CLS,
780778
MODEL_TENSOR.V_ENC_EMBD_PATCH,
781-
MODEL_TENSOR.V_ENC_EMBD_PATCH1,
782779
MODEL_TENSOR.V_ENC_EMBD_POS,
783780
MODEL_TENSOR.V_ENC_ATTN_Q,
784781
MODEL_TENSOR.V_ENC_ATTN_K,

gguf-py/gguf/tensor_mapping.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,6 @@ class TensorNameMap:
923923
"visual.patch_embed.proj", # qwen2vl
924924
),
925925

926-
MODEL_TENSOR.V_ENC_EMBD_PATCH1: (
927-
"visual.patch_embed.proj.weight.1", # qwen2vl, generated
928-
),
929-
930926
MODEL_TENSOR.V_ENC_EMBD_POS: (
931927
"vision_tower.vision_model.embeddings.position_embedding",
932928
"vpm.embeddings.position_embedding",

0 commit comments

Comments
 (0)