Skip to content

Commit 5645497

Browse files
fix rope alpha assert and bos token
Signed-off-by: stevenkuang <[email protected]>
1 parent aa973ca commit 5645497

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

convert_hf_to_gguf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7595,7 +7595,8 @@ def set_vocab(self):
75957595
special_vocab = gguf.SpecialVocab(self.dir_model, load_merges=False)
75967596
special_vocab.add_to_gguf(self.gguf_writer)
75977597
# FIX for BOS token: Overwrite incorrect id read from config.json
7598-
self.gguf_writer.add_bos_token_id(127958) # <|bos|>
7598+
if self.hparams['hidden_size'] == 4096:
7599+
self.gguf_writer.add_bos_token_id(127958) # only for 7b dense, fix <|bos|> token
75997600

76007601
def set_gguf_parameters(self):
76017602
super().set_gguf_parameters()
@@ -7620,7 +7621,7 @@ def set_gguf_parameters(self):
76207621
self.gguf_writer.add_context_length(256 * 1024) # 256k context length
76217622

76227623
# if any of our assumptions about the values are wrong, something has changed and this may need to be updated
7623-
assert alpha == 50 and base == 10000.0 and self.hparams["max_position_embeddings"] in [32 * 1024, 256 * 1024] , \
7624+
assert base == 10000.0 and self.hparams["max_position_embeddings"] in [32 * 1024, 256 * 1024] , \
76247625
"HunYuan dynamic RoPE scaling assumptions changed, please update the logic or context length manually"
76257626

76267627
_experts: list[dict[str, Tensor]] | None = None

0 commit comments

Comments
 (0)