From: Xuan-Son Nguyen Date: Wed, 9 Jul 2025 06:26:13 +0000 (+0200) Subject: convert : fix smollm3 jinja template (#14586) X-Git-Tag: upstream/0.0.5882~32 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=20b7bf8a32259ad9189a4797fd3e3a859c537b99;p=pkg%2Fggml%2Fsources%2Fllama.cpp convert : fix smollm3 jinja template (#14586) --- diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index 3f3dfb41..5d12d479 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -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 ######