@@ -105,6 +105,7 @@ class Params:
105
105
f_norm_eps : float
106
106
107
107
f_rope_freq_base : Optional [float ] = None
108
+ f_rope_scale : Optional [float ] = None
108
109
109
110
ftype : Optional [GGMLFileType ] = None
110
111
@@ -169,6 +170,11 @@ def loadHFTransformerJson(model: 'LazyModel', config_path: 'Path') -> 'Params':
169
170
f_norm_eps = config ["rms_norm_eps" ]
170
171
f_rope_freq_base = config ["rope_theta" ] if "rope_theta" in config else None
171
172
173
+ if "rope_scaling" in config and config ["rope_scaling" ].get ("type" ) == "linear" :
174
+ f_rope_scale = config ["rope_scaling" ].get ("factor" )
175
+ else :
176
+ f_rope_scale = None
177
+
172
178
n_mult = Params .find_n_mult (n_ff , n_embd )
173
179
174
180
if "max_sequence_length" in config :
@@ -190,6 +196,7 @@ def loadHFTransformerJson(model: 'LazyModel', config_path: 'Path') -> 'Params':
190
196
n_head_kv = n_head_kv ,
191
197
f_norm_eps = f_norm_eps ,
192
198
f_rope_freq_base = f_rope_freq_base ,
199
+ f_rope_scale = f_rope_scale ,
193
200
)
194
201
195
202
# LLaMA v2 70B params.json
@@ -773,6 +780,9 @@ def add_meta_arch(self, params: Params) -> None:
773
780
if params .f_rope_freq_base :
774
781
self .gguf .add_rope_freq_base (params .f_rope_freq_base )
775
782
783
+ if params .f_rope_scale :
784
+ self .gguf .add_rope_scale_linear (params .f_rope_scale )
785
+
776
786
if params .ftype :
777
787
self .gguf .add_file_type (params .ftype )
778
788
0 commit comments