Repository: hiyouga/LLaMA-Factory
File: src/llamafactory/data/template.py (Python)

Code before:
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    format_observation=StringFormatter(slots=["
tool\n{{content}}
\n
assistant\n"]),
    default_system=(
        "你是一个经过良好训练的AI助手，你的名字是Marco-o1."
        "由阿里国际数字商业集团的AI Business创造.\n## 重要！！！！！\n"
        "当你回答问题时，你的思考应该在<Thought>内完成，<Output>内输出你的结果。\n"
        "<Thought>应该尽可能是英文，但是有2个特例，一个是对原文中的引用，另一个是是数学应该使用markdown格式，<Output>内的输出需要遵循用户输入的语言。\n"
    ),
    stop_words=["
"],
)


# copied from qwen template
register_template(
    name="mimo",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    format_function=FunctionFormatter(slots=["{{content}}
\n"], tool_format="qwen"),
    format_observation=StringFormatter(
        slots=["
user\n<tool_response>\n{{content}}\n</tool_response>
\n
assistant\n"]
    ),
    format_tools=ToolFormatter(tool_format="qwen"),
    default_system="You are a helpful assistant.",
    stop_words=["
"],
    replace_eos=True,
)


# copied from chatml template
register_template(
    name="minicpm_v",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    stop_words=["
"],
    default_system="You are a helpful assistant.",
    mm_plugin=get_mm_plugin(name="minicpm_v", image_token="<image>", video_token="<video>"),
)


# copied from minicpm_v template
register_template(
    name="minicpm_o",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    stop_words=["
"],
    default_system="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
    mm_plugin=get_mm_plugin(name="minicpm_v", image_token="<image>", video_token="<video>", audio_token="<audio>"),
)

Review comment (suggestion):
is mimo 7b a reasoning model? if it is, we should use the reasoning template class https://github.com/hiyouga/LLaMA-Factory/blob/52f25651a2016ddede2283be17cf40c2c1b906ed/src/llamafactory/data/template.py#L840

Code after:
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    format_observation=StringFormatter(slots=["
tool\n{{content}}
\n
assistant\n"]),
    default_system=(
        "你是一个经过良好训练的AI助手，你的名字是Marco-o1."
        "由阿里国际数字商业集团的AI Business创造.\n## 重要！！！！！\n"
        "当你回答问题时，你的思考应该在<Thought>内完成，<Output>内输出你的结果。\n"
        "<Thought>应该尽可能是英文，但是有2个特例，一个是对原文中的引用，另一个是是数学应该使用markdown格式，<Output>内的输出需要遵循用户输入的语言。\n"
    ),
    stop_words=["
"],
)


# copied from qwen template
register_template(
    name="mimo",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    format_function=FunctionFormatter(slots=["{{content}}
\n"], tool_format="qwen"),
    format_observation=StringFormatter(
        slots=["
user\n<tool_response>\n{{content}}\n</tool_response>
\n
assistant\n"]
    ),
    format_tools=ToolFormatter(tool_format="qwen"),
    default_system="You are a helpful assistant.",
    stop_words=["
"],
    replace_eos=True,
    template_class=ReasoningTemplate,
)


# copied from chatml template
register_template(
    name="minicpm_v",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    stop_words=["
"],
    default_system="You are a helpful assistant.",
    mm_plugin=get_mm_plugin(name="minicpm_v", image_token="<image>", video_token="<video>"),
)


# copied from minicpm_v template
register_template(
    name="minicpm_o",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n"]),
    stop_words=["
"],
    default_system="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
    mm_plugin=get_mm_plugin(name="minicpm_v", image_token="<image>", video_token="<video>", audio_token="<audio>"),