Skip to content

Commit ccdc372

Browse files
committed
restore hparams text
1 parent 975e13f commit ccdc372

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

convert_hf_to_gguf.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -750,10 +750,9 @@ def __init__(self, *args, **kwargs):
750750
else:
751751
self.hf_arch = ""
752752

753-
llm_config_key = "lm_config" if "lm_config" in self.hparams else "text_config"
754-
if llm_config_key in self.hparams:
753+
if "text_config" in self.hparams:
755754
# move the text_config to the root level
756-
self.hparams = {**self.hparams, **self.hparams[llm_config_key]}
755+
self.hparams = {**self.hparams, **self.hparams["text_config"]}
757756

758757
self.block_count = self.find_hparam(["n_layers", "num_hidden_layers", "n_layer", "num_layers"])
759758
self.tensor_map = gguf.get_tensor_name_map(self.model_arch, self.block_count)
@@ -1646,12 +1645,11 @@ def __init__(self, *args, **kwargs):
16461645

16471646
# get n_embd of the text model
16481647
if not self.is_mistral_format:
1649-
llm_config_key = "lm_config" if "lm_config" in self.hparams else "text_config"
1650-
if llm_config_key not in self.hparams:
1648+
if "text_config" not in self.hparams:
16511649
self.hparams["text_config"] = {}
16521650
if "audio_config" not in self.hparams:
16531651
self.hparams["audio_config"] = {}
1654-
text_config = {**self.hparams, **self.hparams[llm_config_key]}
1652+
text_config = {**self.hparams, **self.hparams["text_config"]}
16551653
self.n_embd_text = text_config.get("hidden_size", text_config.get("n_embd", 0))
16561654
else:
16571655
text_config = {

0 commit comments

Comments
 (0)