Skip to content

Commit e078a63

Browse files
committed
[fix] skip mtp layer
1 parent b359533 commit e078a63

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

convert_hf_to_gguf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7861,6 +7861,12 @@ def set_gguf_parameters(self):
78617861
_experts: list[dict[str, Tensor]] | None = None
78627862

78637863
def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]:
7864+
# skip Multi-Token Prediction (MTP) layers
7865+
block_count = self.hparams["num_hidden_layers"]
7866+
match = re.match(r"model.layers.(\d+)", name)
7867+
if match and int(match.group(1)) >= block_count:
7868+
return []
7869+
78647870
if name.endswith("query_key_value.weight"):
78657871
n_head = self.hparams["num_attention_heads"]
78667872
n_kv_head = self.hparams.get("num_key_value_heads")

0 commit comments

Comments
 (0)