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