From d2c1df7f3d811683700f5cad75430598182f806e Mon Sep 17 00:00:00 2001 From: Jianbai Ye Date: Mon, 27 May 2024 20:42:08 +0800 Subject: [PATCH 1/3] add openchat-3.6-8B support Former-commit-id: cff815391fd15f30647e8694e08c47a514fd6eb2 --- src/llamafactory/data/template.py | 17 +++++++++++++++++ src/llamafactory/extras/constants.py | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 979390ce..eba23271 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -756,6 +756,23 @@ _register_template( force_system=True, ) +_register_template( + name="openchat-3.6", + format_user=StringFormatter( + slots=[ + ( + "<|start_header_id|>GPT4 Correct User<|end_header_id|>\n\n{{content}}<|eot_id|>" + "<|start_header_id|>GPT4 Correct Assistant<|end_header_id|>\n\n" + ) + ] + ), + format_system=StringFormatter( + slots=[{"bos_token"}, "<|start_header_id|>System<|end_header_id|>\n\n{{content}}<|eot_id|>"] + ), + stop_words=["<|eot_id|>"], + replace_eos=True, +) + _register_template( name="orion", diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index 087612fc..503df641 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -706,6 +706,15 @@ register_model_group( template="openchat", ) +register_model_group( + models={ + "OpenChat3.6-8B-Chat": { + DownloadSource.DEFAULT: "openchat/openchat-3.6-8b-20240522", + } + }, + template="openchat-3.6", +) + register_model_group( models={ From b7b82232303e2dfd4e25ab80ab3b3223929bb8c5 Mon Sep 17 00:00:00 2001 From: hoshi-hiyouga Date: Mon, 27 May 2024 20:51:26 +0800 Subject: [PATCH 2/3] Update template.py Former-commit-id: 122213a7a7e114b0c390158cac0ae9faeceb2efc --- src/llamafactory/data/template.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index eba23271..3d719e5b 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -761,16 +761,15 @@ _register_template( format_user=StringFormatter( slots=[ ( - "<|start_header_id|>GPT4 Correct User<|end_header_id|>\n\n{{content}}<|eot_id|>" + "<|start_header_id|>GPT4 Correct User<|end_header_id|>\n\n{{content}}<|eot_id|>", "<|start_header_id|>GPT4 Correct Assistant<|end_header_id|>\n\n" ) ] ), - format_system=StringFormatter( - slots=[{"bos_token"}, "<|start_header_id|>System<|end_header_id|>\n\n{{content}}<|eot_id|>"] - ), + format_system=StringFormatter(slots=[{"bos_token"}, "{{content}}"]), stop_words=["<|eot_id|>"], replace_eos=True, + force_system=True, ) From eceec1d7fd52fec7bc258470db319f6ed4e4b971 Mon Sep 17 00:00:00 2001 From: hoshi-hiyouga Date: Mon, 27 May 2024 20:51:56 +0800 Subject: [PATCH 3/3] Update template.py Former-commit-id: f1002b9f930758bb27794ab88a2adbe24417b076 --- src/llamafactory/data/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 3d719e5b..5a12524d 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -761,7 +761,7 @@ _register_template( format_user=StringFormatter( slots=[ ( - "<|start_header_id|>GPT4 Correct User<|end_header_id|>\n\n{{content}}<|eot_id|>", + "<|start_header_id|>GPT4 Correct User<|end_header_id|>\n\n{{content}}<|eot_id|>" "<|start_header_id|>GPT4 Correct Assistant<|end_header_id|>\n\n" ) ]