]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
convert : fix smollm3 jinja template (#14586)
authorXuan-Son Nguyen <redacted>
Wed, 9 Jul 2025 06:26:13 +0000 (08:26 +0200)
committerGitHub <redacted>
Wed, 9 Jul 2025 06:26:13 +0000 (09:26 +0300)
convert_hf_to_gguf.py

index 3f3dfb416c1fc24a32128ba1cbd38b00abcd8314..5d12d4799fafcb90230cb2455d50e0d3c48aa7ef 100755 (executable)
@@ -6692,6 +6692,16 @@ class HunYuanMoEModel(TextModel):
 class SmolLM3Model(LlamaModel):
     model_arch = gguf.MODEL_ARCH.SMOLLM3
 
+    def set_vocab(self):
+        super().set_vocab()
+        # remove unsupported array slicing in chat template
+        # ref: https://huggingface.co/ggml-org/SmolLM3-3B-GGUF/discussions/1
+        from transformers import AutoTokenizer
+        tokenizer = AutoTokenizer.from_pretrained(self.dir_model)
+        if tokenizer.chat_template is not None:
+            chat_template = tokenizer.chat_template.replace("[:]", "")
+            self.gguf_writer.add_chat_template(chat_template)
+
 ###### CONVERSION LOGIC ######