@@ -1099,13 +1099,6 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
10991099
11001100 tensors .append ((self .map_tensor_name (name ), data_torch ))
11011101
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-
11091102 return tensors
11101103
11111104
@@ -2404,10 +2397,6 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
24042397
24052398 tensors .append ((new_name , data_torch ))
24062399
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-
24112400 return tensors
24122401
24132402
@@ -2737,22 +2726,6 @@ def set_gguf_parameters(self):
27372726 self .gguf_writer .add_rope_scaling_type (gguf .RopeScalingType .LINEAR )
27382727 self .gguf_writer .add_rope_scaling_factor (1.0 )
27392728
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-
27562729
27572730@Model .register ("InternLM2ForCausalLM" )
27582731class InternLM2Model (Model ):
0 commit comments