mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-07-30 18:22:51 +08:00
Compare commits
2 Commits
3307ff1d4a
...
7218d4aa96
Author | SHA1 | Date | |
---|---|---|---|
|
7218d4aa96 | ||
|
4380b7b35e |
@ -211,10 +211,10 @@ class MultiModalDataCollatorForSeq2Seq(DataCollatorForSeq2Seq):
|
||||
if (
|
||||
self.model is not None
|
||||
and getattr(self.model.config, "model_type", None)
|
||||
in ["glm4v", "qwen2_vl", "qwen2_5_vl", "qwen2_5_omni_thinker"]
|
||||
in ["glm4v", "Keye", "qwen2_vl", "qwen2_5_vl", "qwen2_5_omni_thinker"]
|
||||
and ("position_ids" not in features or features["position_ids"].dim() != 3)
|
||||
):
|
||||
raise ValueError("Qwen2-VL/Qwen2.5-Omni model requires 3D position ids for mrope.")
|
||||
raise ValueError(f"{self.model.config.model_type} requires 3D position ids for mrope.")
|
||||
|
||||
if "cross_attention_mask" in mm_inputs: # for mllama inputs when pad_to_multiple_of is enabled
|
||||
cross_attention_mask = mm_inputs.pop("cross_attention_mask")
|
||||
|
@ -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."),
|
||||
)
|
||||
|
||||
|
||||
@ -1169,6 +1171,24 @@ register_template(
|
||||
)
|
||||
|
||||
|
||||
# copied from qwen template
|
||||
register_template(
|
||||
name="keye_vl",
|
||||
format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]),
|
||||
format_assistant=StringFormatter(slots=["{{content}}<|im_end|>\n"]),
|
||||
format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]),
|
||||
format_function=FunctionFormatter(slots=["{{content}}<|im_end|>\n"], tool_format="qwen"),
|
||||
format_observation=StringFormatter(
|
||||
slots=["<|im_start|>user\n<tool_response>\n{{content}}\n</tool_response><|im_end|>\n<|im_start|>assistant\n"]
|
||||
),
|
||||
format_tools=ToolFormatter(tool_format="qwen"),
|
||||
stop_words=["<|im_end|>"],
|
||||
replace_eos=True,
|
||||
mm_plugin=get_mm_plugin(name="qwen2_vl", image_token="<|image_pad|>", video_token="<|video_pad|>"),
|
||||
template_class=ReasoningTemplate,
|
||||
)
|
||||
|
||||
|
||||
register_template(
|
||||
name="kimi_vl",
|
||||
format_user=StringFormatter(
|
||||
|
@ -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",
|
||||
},
|
||||
},
|
||||
@ -1212,6 +1235,18 @@ register_model_group(
|
||||
)
|
||||
|
||||
|
||||
register_model_group(
|
||||
models={
|
||||
"Keye-VL-8B-Chat": {
|
||||
DownloadSource.DEFAULT: "Kwai-Keye/Keye-VL-8B-Preview",
|
||||
DownloadSource.MODELSCOPE: "Kwai-Keye/Keye-VL-8B-Preview",
|
||||
},
|
||||
},
|
||||
template="keye_vl",
|
||||
multimodal=True,
|
||||
)
|
||||
|
||||
|
||||
register_model_group(
|
||||
models={
|
||||
"Kimi-Dev-72B-Instruct": {
|
||||
|
@ -226,6 +226,15 @@ _register_composite_model(
|
||||
)
|
||||
|
||||
|
||||
_register_composite_model(
|
||||
model_type="Keye",
|
||||
projector_key="mlp_AR",
|
||||
vision_model_keys=["visual.vision_model.patch_embedding", "visual.vision_model.encoder"],
|
||||
language_model_keys=["model", "lm_head"],
|
||||
lora_conflict_keys=["patch_embedding"],
|
||||
)
|
||||
|
||||
|
||||
_register_composite_model(
|
||||
model_type="llama4",
|
||||
vision_model_keys=["vision_model"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user