@@ -6645,10 +6645,11 @@ def set_gguf_parameters(self):
6645
6645
def modify_tensors (
6646
6646
self , data_torch : Tensor , name : str , bid : int | None
6647
6647
) -> Iterable [tuple [str , Tensor ]]:
6648
- # Handle special GLM4_MOE layer 46 tensors (nextn prediction layer)
6648
+ # Handle layer 46 tensors - preserve all for future MTP support
6649
6649
if bid is not None and bid == 46 :
6650
- # Layer 46 is the nextn prediction layer - skip all tensors
6651
- return []
6650
+ # Convert layer 46 tensors to GGUF naming but don't try to map them
6651
+ new_name = name .replace ("model.layers." , "blk." )
6652
+ return [(new_name , data_torch )]
6652
6653
6653
6654
if name .startswith ("model.visual." ): # ignore visual part
6654
6655
return []
@@ -6659,8 +6660,8 @@ def modify_tensors(
6659
6660
if name == "model.embed_tokens.weight" :
6660
6661
return [(self .map_tensor_name ("token_embd.weight" ), data_torch )]
6661
6662
6662
- # Handle routed experts
6663
- if name .find ("mlp.experts" ) != - 1 and "shared_experts" not in name :
6663
+ # Handle routed experts (skip for NextN layer 46)
6664
+ if name .find ("mlp.experts" ) != - 1 and "shared_experts" not in name and bid != 46 :
6664
6665
n_experts = self .hparams ["n_routed_experts" ]
6665
6666
assert bid is not None
6666
6667
@@ -6727,16 +6728,17 @@ def modify_tensors(
6727
6728
new_name = name
6728
6729
return [(self .map_tensor_name (new_name ), data_torch )]
6729
6730
6730
- # Handle other special GLM4_MOE tensors (nextn prediction)
6731
+ # Handle special NextN tensors - preserve for future MTP support
6731
6732
if (
6732
6733
".embed_tokens." in name
6733
6734
or ".shared_head." in name
6734
6735
or ".eh_proj." in name
6735
6736
or ".enorm." in name
6736
6737
or ".hnorm." in name
6737
6738
):
6738
- # Skip these special tensors - they are for nextn prediction
6739
- return []
6739
+ # For NextN tensors, convert to GGUF naming convention
6740
+ new_name = name .replace ("model.layers." , "blk." ).replace ("model." , "" )
6741
+ return [(new_name , data_torch )]
6740
6742
6741
6743
return super ().modify_tensors (data_torch , name , bid )
6742
6744
0 commit comments