Skip to content

Commit 6336d83

Browse files
authored
convert : fix F32 ftype not being saved (#3048)
1 parent 00d62ad commit 6336d83

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

convert.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def loadOriginalParamsJson(model: LazyModel, config_path: Path) -> Params:
266266
f_rope_freq_base = config["rope_theta"] if "rope_theta" in config else None
267267

268268
# hack to determine LLaMA v1 vs v2 vs CodeLlama
269-
if f_rope_freq_base and f_rope_freq_base == 1000000:
269+
if f_rope_freq_base == 1000000:
270270
# CodeLlama
271271
n_ctx = 16384
272272
elif config["norm_eps"] == 1e-05:
@@ -841,9 +841,9 @@ def add_meta_arch(self, params: Params) -> None:
841841
name = "LLaMA"
842842

843843
# TODO: better logic to determine model name
844-
if (params.n_ctx == 4096):
844+
if params.n_ctx == 4096:
845845
name = "LLaMA v2"
846-
elif params.path_model:
846+
elif params.path_model is not None:
847847
name = str(params.path_model.parent).split('/')[-1]
848848

849849
self.gguf.add_name (name)
@@ -856,13 +856,13 @@ def add_meta_arch(self, params: Params) -> None:
856856
self.gguf.add_head_count_kv (params.n_head_kv)
857857
self.gguf.add_layer_norm_rms_eps (params.f_norm_eps)
858858

859-
if params.f_rope_freq_base:
859+
if params.f_rope_freq_base is not None:
860860
self.gguf.add_rope_freq_base(params.f_rope_freq_base)
861861

862-
if params.f_rope_scale:
862+
if params.f_rope_scale is not None:
863863
self.gguf.add_rope_scale_linear(params.f_rope_scale)
864864

865-
if params.ftype:
865+
if params.ftype is not None:
866866
self.gguf.add_file_type(params.ftype)
867867

868868
def add_meta_vocab(self, vocab: Vocab) -> None:

0 commit comments

Comments
 (0)