From e1246cc50763f55ed2297cc945b48b16d61b055c Mon Sep 17 00:00:00 2001 From: hiyouga Date: Thu, 22 Feb 2024 12:06:48 +0800 Subject: [PATCH] fix template Former-commit-id: c375a20230cfad3f398dfa0a1140d5b071fca687 --- src/llmtuner/data/template.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/llmtuner/data/template.py b/src/llmtuner/data/template.py index 523520ea..38915993 100644 --- a/src/llmtuner/data/template.py +++ b/src/llmtuner/data/template.py @@ -367,6 +367,16 @@ _register_template( ) +_register_template( + name="chatml", + format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), + format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]), + format_separator=EmptyFormatter(slots=["\n"]), + stop_words=["<|im_end|>"], + replace_eos=True, +) + + _register_template( name="chatml_de", format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), @@ -437,9 +447,8 @@ _register_template( name="gemma", format_user=StringFormatter(slots=["user\n{{content}}\nmodel\n"]), format_system=StringFormatter(slots=["{{content}}"]), - format_separator=EmptyFormatter(slots=["\n"]), - stop_words=[""], - replace_eos=True, + format_separator=EmptyFormatter(slots=["\n"]), + efficient_eos=True, )