From 7b4f5d3b21c1677246ac2016225816baccb9a746 Mon Sep 17 00:00:00 2001 From: moontidef <53668275+relic-yuexi@users.noreply.github.com> Date: Mon, 5 Aug 2024 23:55:45 +0800 Subject: [PATCH 1/2] fix: fix the deepseekcoder template to avoid repeat problem Former-commit-id: 56294831115f095135f72490a8a435434b2f0a11 --- src/llamafactory/data/template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index db0393d1..0ec95f33 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -586,8 +586,7 @@ _register_template( _register_template( name="deepseekcoder", format_user=StringFormatter(slots=["### Instruction:\n{{content}}\n### Response:"]), - format_assistant=StringFormatter(slots=["\n{{content}}\n"]), - format_separator=EmptyFormatter(slots=["\n"]), + format_assistant=StringFormatter(slots=["{{content}}\n<|EOT|>"]), format_prefix=EmptyFormatter(slots=[{"bos_token"}]), default_system=( "You are an AI programming assistant, utilizing the Deepseek Coder model, " @@ -595,6 +594,8 @@ _register_template( "For politically sensitive questions, security and privacy issues, " "and other non-computer science questions, you will refuse to answer\n" ), + stop_words=["<|EOT|>"], + replace_eos=True, ) From 46f834ec75046dc090a0f05a9d6653c1a3e2a18f Mon Sep 17 00:00:00 2001 From: hoshi-hiyouga Date: Fri, 9 Aug 2024 16:27:42 +0800 Subject: [PATCH 2/2] Update template.py Former-commit-id: ae2a5221c109ae3474d219c37433be767abbee91 --- src/llamafactory/data/template.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 0ec95f33..f4d73701 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -586,7 +586,8 @@ _register_template( _register_template( name="deepseekcoder", format_user=StringFormatter(slots=["### Instruction:\n{{content}}\n### Response:"]), - format_assistant=StringFormatter(slots=["{{content}}\n<|EOT|>"]), + format_assistant=StringFormatter(slots=["\n{{content}}\n<|EOT|>"]), + format_separator=EmptyFormatter(slots=["\n"]), format_prefix=EmptyFormatter(slots=[{"bos_token"}]), default_system=( "You are an AI programming assistant, utilizing the Deepseek Coder model, " @@ -594,8 +595,6 @@ _register_template( "For politically sensitive questions, security and privacy issues, " "and other non-computer science questions, you will refuse to answer\n" ), - stop_words=["<|EOT|>"], - replace_eos=True, )