From b38661af44ff0ef6b95fdd10b6ba602595b20386 Mon Sep 17 00:00:00 2001 From: Rodrigo Meireles de Oliveira Date: Wed, 4 Sep 2024 18:05:31 -0300 Subject: [PATCH] Changing lstrip -> strip to address trailing spaces/newlines in chat formatting for Ollama (#992) --- unsloth/chat_templates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/chat_templates.py b/unsloth/chat_templates.py index d81413ae..e62d6586 100644 --- a/unsloth/chat_templates.py +++ b/unsloth/chat_templates.py @@ -1281,7 +1281,7 @@ def construct_chat_template( \ You must use {INPUT}, {OUTPUT} twice, and {SYSTEM} is optional. """ # Strip only the left - chat_template = chat_template.lstrip() + chat_template = chat_template.strip() assert(tokenizer is not None)