From b63cafd32967946f545fc83a8b47a1d6368f2fde Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 12 Mar 2025 21:52:38 -0700 Subject: [PATCH] Update chat_templates.py --- unsloth/chat_templates.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unsloth/chat_templates.py b/unsloth/chat_templates.py index 87ff6f5153..2c2e36182d 100644 --- a/unsloth/chat_templates.py +++ b/unsloth/chat_templates.py @@ -1940,6 +1940,11 @@ extra_eos_tokens = None, tokenizer._ollama_modelfile = modelfile tokenizer._unsloth_input_part = input_part tokenizer._unsloth_output_part = output_part + if hasattr(tokenizer, "tokenizer"): + tokenizer.tokenizer.chat_template = jinja_template + tokenizer.tokenizer._ollama_modelfile = modelfile + tokenizer.tokenizer._unsloth_input_part = input_part + tokenizer.tokenizer._unsloth_output_part = output_part return dataset.map(formatting_prompts_func, batched = True,) pass