diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 701cd239..84f41b11 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -1071,6 +1071,7 @@ register_template( stop_words=["<|im_end|>"], thought_words=("◁think▷", "◁/think▷"), mm_plugin=get_mm_plugin("kimi_vl", image_token="<|media_pad|>"), + template_class=ReasoningTemplate, ) @@ -1354,6 +1355,24 @@ register_template( template_class=ReasoningTemplate, ) +# copied from qwen2vl +register_template( + name="mimo_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\n{{content}}\n<|im_end|>\n<|im_start|>assistant\n"] + ), + format_tools=ToolFormatter(tool_format="qwen"), + default_system="You are MiMo, an AI assistant developed by Xiaomi.", + 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, +) + # copied from chatml template register_template( @@ -1695,15 +1714,9 @@ register_template( register_template( name="smollm2", - format_system=StringFormatter( - slots=["<|im_start|>system\n{{content}}<|im_end|>\n"] - ), - 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_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), + format_assistant=StringFormatter(slots=["{{content}}<|im_end|>\n"]), stop_words=["<|im_end|>"], default_system="You are a helpful AI assistant named SmolLM, trained by Hugging Face.", ) diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index 11b3319e..06e450c9 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -1460,6 +1460,22 @@ register_model_group( ) +register_model_group( + models={ + "MiMo-7B-VL-Instruct": { + DownloadSource.DEFAULT: "XiaomiMiMo/MiMo-VL-7B-SFT", + DownloadSource.MODELSCOPE: "XiaomiMiMo/MiMo-VL-7B-SFT", + }, + "MiMo-7B-VL-RL": { + DownloadSource.DEFAULT: "XiaomiMiMo/MiMo-VL-7B-RL", + DownloadSource.MODELSCOPE: "XiaomiMiMo/MiMo-VL-7B-RL", + }, + }, + template="mimo_vl", + multimodal=True, +) + + register_model_group( models={ "MiniCPM-2B-SFT-Chat": {