@@ -1099,13 +1099,6 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
1099
1099
1100
1100
tensors .append ((self .map_tensor_name (name ), data_torch ))
1101
1101
1102
- if name == "word_embeddings.weight" :
1103
- assert self .tensor_names is not None
1104
-
1105
- # TODO: tie them at runtime, don't duplicate in the model file
1106
- if all (s not in self .tensor_names for s in ("lm_head.weight" , "output.weight" )):
1107
- tensors .append ((self .format_tensor_name (gguf .MODEL_TENSOR .OUTPUT ), data_torch ))
1108
-
1109
1102
return tensors
1110
1103
1111
1104
@@ -2404,10 +2397,6 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
2404
2397
2405
2398
tensors .append ((new_name , data_torch ))
2406
2399
2407
- # note: GPT2 output is tied to (same as) wte in original model
2408
- if new_name == self .format_tensor_name (gguf .MODEL_TENSOR .TOKEN_EMBD ):
2409
- tensors .append ((self .format_tensor_name (gguf .MODEL_TENSOR .OUTPUT ), data_torch ))
2410
-
2411
2400
return tensors
2412
2401
2413
2402
@@ -2737,22 +2726,6 @@ def set_gguf_parameters(self):
2737
2726
self .gguf_writer .add_rope_scaling_type (gguf .RopeScalingType .LINEAR )
2738
2727
self .gguf_writer .add_rope_scaling_factor (1.0 )
2739
2728
2740
- def modify_tensors (self , data_torch : Tensor , name : str , bid : int | None ) -> Iterable [tuple [str , Tensor ]]:
2741
- del bid # unused
2742
-
2743
- new_name = self .map_tensor_name (name )
2744
-
2745
- tensors : list [tuple [str , Tensor ]] = [(new_name , data_torch )]
2746
-
2747
- if new_name == self .format_tensor_name (gguf .MODEL_TENSOR .TOKEN_EMBD ):
2748
- assert self .tensor_names is not None
2749
-
2750
- if all (s not in self .tensor_names for s in ("lm_head.weight" , "output.weight" )):
2751
- # copy tok_embd.weight to output.weight
2752
- tensors .append ((self .format_tensor_name (gguf .MODEL_TENSOR .OUTPUT ), data_torch ))
2753
-
2754
- return tensors
2755
-
2756
2729
2757
2730
@Model .register ("InternLM2ForCausalLM" )
2758
2731
class InternLM2Model (Model ):
0 commit comments