From 4380b7b35eb91338473279606c72de1a394333b7 Mon Sep 17 00:00:00 2001 From: Kingsley Date: Tue, 29 Jul 2025 19:57:29 +0800 Subject: [PATCH] [model] update glm4.5 (#8770) --- src/llamafactory/data/template.py | 6 ++-- src/llamafactory/extras/constants.py | 51 ++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index e49db8b4..a7868abc 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -1096,10 +1096,12 @@ register_template( format_assistant=StringFormatter(slots=["{{content}}<|end_of_text|>\n"]), format_system=StringFormatter(slots=["<|start_of_role|>system<|end_of_role|>{{content}}<|end_of_text|>\n"]), format_function=FunctionFormatter(slots=["{{content}}<|end_of_text|>\n"], tool_format="default"), - format_observation=StringFormatter(slots=["<|start_of_role|>tool<|end_of_role|>{{content}}<|end_of_text|>\n<|start_of_role|>assistant\n"]), + format_observation=StringFormatter( + slots=["<|start_of_role|>tool<|end_of_role|>{{content}}<|end_of_text|>\n<|start_of_role|>assistant\n"] + ), format_tools=ToolFormatter(tool_format="default"), stop_words=["<|end_of_text|>"], - default_system=("You are Granite, developed by IBM. You are a helpful AI assistant.") + default_system=("You are Granite, developed by IBM. You are a helpful AI assistant."), ) diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index c794b69b..0cf91b60 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -276,7 +276,7 @@ register_model_group( register_model_group( models={ "ChatGLM2-6B-Chat": { - DownloadSource.DEFAULT: "THUDM/chatglm2-6b", + DownloadSource.DEFAULT: "zai-org/chatglm2-6b", DownloadSource.MODELSCOPE: "ZhipuAI/chatglm2-6b", } }, @@ -287,11 +287,11 @@ register_model_group( register_model_group( models={ "ChatGLM3-6B-Base": { - DownloadSource.DEFAULT: "THUDM/chatglm3-6b-base", + DownloadSource.DEFAULT: "zai-org/chatglm3-6b-base", DownloadSource.MODELSCOPE: "ZhipuAI/chatglm3-6b-base", }, "ChatGLM3-6B-Chat": { - DownloadSource.DEFAULT: "THUDM/chatglm3-6b", + DownloadSource.DEFAULT: "zai-org/chatglm3-6b", DownloadSource.MODELSCOPE: "ZhipuAI/chatglm3-6b", }, }, @@ -333,7 +333,7 @@ register_model_group( register_model_group( models={ "CodeGeeX4-9B-Chat": { - DownloadSource.DEFAULT: "THUDM/codegeex4-all-9b", + DownloadSource.DEFAULT: "zai-org/codegeex4-all-9b", DownloadSource.MODELSCOPE: "ZhipuAI/codegeex4-all-9b", }, }, @@ -840,28 +840,28 @@ register_model_group( register_model_group( models={ "GLM-4-9B": { - DownloadSource.DEFAULT: "THUDM/glm-4-9b", + DownloadSource.DEFAULT: "zai-org/glm-4-9b", DownloadSource.MODELSCOPE: "ZhipuAI/glm-4-9b", }, "GLM-4-9B-Chat": { - DownloadSource.DEFAULT: "THUDM/glm-4-9b-chat", + DownloadSource.DEFAULT: "zai-org/glm-4-9b-chat", DownloadSource.MODELSCOPE: "ZhipuAI/glm-4-9b-chat", DownloadSource.OPENMIND: "LlamaFactory/glm-4-9b-chat", }, "GLM-4-9B-1M-Chat": { - DownloadSource.DEFAULT: "THUDM/glm-4-9b-chat-1m", + DownloadSource.DEFAULT: "zai-org/glm-4-9b-chat-1m", DownloadSource.MODELSCOPE: "ZhipuAI/glm-4-9b-chat-1m", }, "GLM-4-0414-9B-Chat": { - DownloadSource.DEFAULT: "THUDM/GLM-4-9B-0414", + DownloadSource.DEFAULT: "zai-org/GLM-4-9B-0414", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4-9B-0414", }, "GLM-4-0414-32B-Base": { - DownloadSource.DEFAULT: "THUDM/GLM-4-32B-Base-0414", + DownloadSource.DEFAULT: "zai-org/GLM-4-32B-Base-0414", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4-32B-Base-0414", }, "GLM-4-0414-32B-Chat": { - DownloadSource.DEFAULT: "THUDM/GLM-4-32B-0414", + DownloadSource.DEFAULT: "zai-org/GLM-4-32B-0414", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4-32B-0414", }, }, @@ -872,11 +872,11 @@ register_model_group( register_model_group( models={ "GLM-4.1V-9B-Base": { - DownloadSource.DEFAULT: "THUDM/GLM-4.1V-9B-Base", + DownloadSource.DEFAULT: "zai-org/GLM-4.1V-9B-Base", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.1V-9B-Base", }, "GLM-4.1V-9B-Thinking": { - DownloadSource.DEFAULT: "THUDM/GLM-4.1V-9B-Thinking", + DownloadSource.DEFAULT: "zai-org/GLM-4.1V-9B-Thinking", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.1V-9B-Thinking", }, }, @@ -885,14 +885,37 @@ register_model_group( ) +register_model_group( + models={ + "GLM-4.5-Air-Base": { + DownloadSource.DEFAULT: "zai-org/GLM-4.5-Air-Base", + DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.5-Air-Base", + }, + "GLM-4.5-Base": { + DownloadSource.DEFAULT: "zai-org/GLM-4.5-Base", + DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.5-Base", + }, + "GLM-4.5-Air-Chat": { + DownloadSource.DEFAULT: "zai-org/GLM-4.5-Air", + DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.5-Air", + }, + "GLM-4.5-Chat": { + DownloadSource.DEFAULT: "zai-org/GLM-4.5", + DownloadSource.MODELSCOPE: "ZhipuAI/GLM-4.5", + }, + }, + template="glm4_moe", +) + + register_model_group( models={ "GLM-Z1-0414-9B-Chat": { - DownloadSource.DEFAULT: "THUDM/GLM-Z1-9B-0414", + DownloadSource.DEFAULT: "zai-org/GLM-Z1-9B-0414", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-Z1-9B-0414", }, "GLM-Z1-0414-32B-Chat": { - DownloadSource.DEFAULT: "THUDM/GLM-Z1-32B-0414", + DownloadSource.DEFAULT: "zai-org/GLM-Z1-32B-0414", DownloadSource.MODELSCOPE: "ZhipuAI/GLM-Z1-32B-0414", }, },