From 53b1002fb74123095e7466c75b941a31a7cfba4d Mon Sep 17 00:00:00 2001 From: hiyouga <467089858@qq.com> Date: Sat, 6 Jul 2024 16:16:47 +0800 Subject: [PATCH] add codegeex4, internlm2.5 --- src/llamafactory/data/template.py | 17 ++++++++++++++++ src/llamafactory/extras/constants.py | 30 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 9f49ac92..3aa2f4f1 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -510,6 +510,23 @@ _register_template( ) +_register_template( + name="codegeex4", + format_user=StringFormatter(slots=["<|user|>\n{{content}}<|assistant|>\n"]), + format_system=StringFormatter(slots=["<|system|>\n{{content}}"]), + format_function=FunctionFormatter(slots=[], tool_format="glm4"), + format_observation=StringFormatter(slots=["<|observation|>\n{{content}}<|assistant|>\n"]), + format_tools=ToolFormatter(tool_format="glm4"), + format_prefix=EmptyFormatter(slots=["[gMASK]"]), + default_system=( + "你是一位智能编程助手,你叫CodeGeeX。你会为用户回答关于编程、代码、计算机方面的任何问题," + "并提供格式规范、可以执行、准确安全的代码,并在必要时提供详细的解释。" + ), + stop_words=["<|user|>", "<|observation|>"], + efficient_eos=True, +) + + _register_template( name="cohere", format_user=StringFormatter( diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index 1ac61305..ac082043 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -299,6 +299,17 @@ register_model_group( ) +register_model_group( + models={ + "CodeGeeX4-9B-Chat": { + DownloadSource.DEFAULT: "THUDM/codegeex4-all-9b", + DownloadSource.MODELSCOPE: "ZhipuAI/codegeex4-all-9b", + }, + }, + template="codegeex4", +) + + register_model_group( models={ "CodeGemma-7B": { @@ -606,6 +617,25 @@ register_model_group( ) +register_model_group( + models={ + "InternLM2.5-7B": { + DownloadSource.DEFAULT: "internlm/internlm2_5-7b", + DownloadSource.MODELSCOPE: "Shanghai_AI_Laboratory/internlm2_5-7b", + }, + "InternLM2.5-7B-Chat": { + DownloadSource.DEFAULT: "internlm/internlm2_5-7b-chat", + DownloadSource.MODELSCOPE: "Shanghai_AI_Laboratory/internlm2_5-7b-chat", + }, + "InternLM2.5-7B-1M-Chat": { + DownloadSource.DEFAULT: "internlm/internlm2_5-7b-chat-1m", + DownloadSource.MODELSCOPE: "Shanghai_AI_Laboratory/internlm2_5-7b-chat-1m", + }, + }, + template="intern2", +) + + register_model_group( models={ "Jamba-v0.1": {