Skip to content

Commit 79e2a37

Browse files
ngxsonqnixsynapse
authored andcommitted
convert : fix smollm3 jinja template (ggml-org#14586)
1 parent fbe57ae commit 79e2a37

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

convert_hf_to_gguf.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6692,6 +6692,16 @@ def prepare_tensors(self):
66926692
class SmolLM3Model(LlamaModel):
66936693
model_arch = gguf.MODEL_ARCH.SMOLLM3
66946694

6695+
def set_vocab(self):
6696+
super().set_vocab()
6697+
# remove unsupported array slicing in chat template
6698+
# ref: https://huggingface.co/ggml-org/SmolLM3-3B-GGUF/discussions/1
6699+
from transformers import AutoTokenizer
6700+
tokenizer = AutoTokenizer.from_pretrained(self.dir_model)
6701+
if tokenizer.chat_template is not None:
6702+
chat_template = tokenizer.chat_template.replace("[:]", "")
6703+
self.gguf_writer.add_chat_template(chat_template)
6704+
66956705
###### CONVERSION LOGIC ######
66966706

66976707

0 commit comments

Comments
 (0)