From d7ba97be484bf781d6fe80252ea29eb505b261bb Mon Sep 17 00:00:00 2001 From: liudan <403644786@qq.com> Date: Wed, 4 Sep 2024 23:10:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AF=B9minicpm?= =?UTF-8?q?3.0=E7=9A=84=E9=80=82=E9=85=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/llamafactory/data/template.py | 8 +++++++- src/llamafactory/extras/constants.py | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 818e5625..7e1204fd 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -558,7 +558,13 @@ _register_template( format_user=StringFormatter(slots=["<用户>{{content}}"]), format_prefix=EmptyFormatter(slots=[{"bos_token"}]), ) - +_register_template( + name="cpm3", + format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), + format_prefix=EmptyFormatter(slots=[{"bos_token"}]), + format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]), + stop_words=["<|im_end|>"], +) _register_template( name="dbrx", diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index fc2d3460..91537877 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -806,6 +806,15 @@ register_model_group( template="cpm", ) +register_model_group( + models={ + "MiniCPM3-4B": { + DownloadSource.DEFAULT: "openbmb/MiniCPM3-4B", + DownloadSource.MODELSCOPE: "OpenBMB/MiniCPM3-4B", + }, + }, + template="cpm3", +) register_model_group( models={ From 3d3fbaaff98da327e10bdebb4aedbdf1ec9565e8 Mon Sep 17 00:00:00 2001 From: liudan <403644786@qq.com> Date: Thu, 5 Sep 2024 20:17:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9=E4=BA=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/llamafactory/data/template.py | 3 +++ src/llamafactory/extras/constants.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 7e1204fd..a0ebeff1 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -558,6 +558,8 @@ _register_template( format_user=StringFormatter(slots=["<用户>{{content}}"]), format_prefix=EmptyFormatter(slots=[{"bos_token"}]), ) + + _register_template( name="cpm3", format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), @@ -566,6 +568,7 @@ _register_template( stop_words=["<|im_end|>"], ) + _register_template( name="dbrx", format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index 91537877..eadd0973 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -806,6 +806,7 @@ register_model_group( template="cpm", ) + register_model_group( models={ "MiniCPM3-4B": { @@ -816,6 +817,7 @@ register_model_group( template="cpm3", ) + register_model_group( models={ "Mistral-7B-v0.1": {