Skip to content

Commit 3ef6cf5

Browse files
authored
add chat template
1 parent 8edece8 commit 3ef6cf5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

convert_hf_to_gguf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,6 +2700,7 @@ def decode_grok_token(token: dict, toktype: gguf.TokenType) -> tuple[gguf.TokenT
27002700
special_vocab.special_token_ids["pad"] = 0
27012701
special_vocab.special_token_ids["sep"] = 1
27022702
special_vocab.special_token_ids["eos"] = 2
2703+
special_vocab.chat_template = "{% for message in messages %}{% if message['role'] == 'user' %}{{ 'Human: ' + message['content'].strip() + '<|separator|>\n\n' }}{% elif message['role'] == 'system' %}{{ 'System: ' + message['content'].strip() + '<|separator|>\n\n' }}{% elif message['role'] == 'assistant' %}{{ 'Assistant: ' + message['content'] + '<|separator|>\n\n' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ 'Assistant:' }}{% endif %}"
27032704
special_vocab.add_to_gguf(self.gguf_writer)
27042705

27052706
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)