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

Code before:
    format_system=StringFormatter(slots=["System: {{content}}", {"eos_token"}, "\n"]),
    replace_jinja_template=True,
)


register_template(
    name="empty",
    format_assistant=StringFormatter(slots=["{{content}}"]),
)


# copied from chatml template
register_template(
    name="ernie",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n\n"]),
    format_observation=StringFormatter(slots=["
tool\n{{content}}
\n\n
assistant\n"]),
    default_system="<global_setting>\nthink_mode=True\n</global_setting>",
    stop_words=["
"],
)


register_template(
    name="ernie_dense",
    format_user=StringFormatter(slots=["

user
{{content}}

assistant
"]),
    format_assistant=StringFormatter(slots=["{{content}}
"]),
    format_system=StringFormatter(slots=["

system
{{content}}
"]),
    format_prefix=EmptyFormatter(slots=[{"bos_token"}]),
    stop_words=["
"],
)


register_template(
    name="exaone",
    format_user=StringFormatter(slots=["[|user|]{{content}}\n[|assistant|]"]),
    format_assistant=StringFormatter(slots=["{{content}}", {"eos_token"}, "\n"]),
    format_system=StringFormatter(slots=["[|system|]{{content}}[|endofturn|]\n"]),
)


register_template(
    name="falcon",
    format_user=StringFormatter(slots=["User: {{content}}\nFalcon:"]),
    format_assistant=StringFormatter(slots=["{{content}}\n"]),
    efficient_eos=True,
)


# copied from chatml template
register_template(

Review comment (suggestion):
Shouldn't it be `User: Assistant: `? https://huggingface.co/baidu/ERNIE-4.5-0.3B-PT/blob/main/chat_template.jinja

Code after:
    format_system=StringFormatter(slots=["System: {{content}}", {"eos_token"}, "\n"]),
    replace_jinja_template=True,
)


register_template(
    name="empty",
    format_assistant=StringFormatter(slots=["{{content}}"]),
)


# copied from chatml template
register_template(
    name="ernie",
    format_user=StringFormatter(slots=["
user\n{{content}}
\n\n
assistant\n"]),
    format_assistant=StringFormatter(slots=["{{content}}
\n\n"]),
    format_system=StringFormatter(slots=["
system\n{{content}}
\n\n"]),
    format_observation=StringFormatter(slots=["
tool\n{{content}}
\n\n
assistant\n"]),
    default_system="<global_setting>\nthink_mode=True\n</global_setting>",
    stop_words=["
"],
)


register_template(
    name="ernie_nothink",
    format_user=StringFormatter(slots=["User: {{content}}\nAssistant: "]),
    format_assistant=StringFormatter(slots=["{{content}}
"]),
    format_system=StringFormatter(slots=["{{content}}\n"]),
    format_prefix=EmptyFormatter(slots=["
"]),
    stop_words=["
"],
)


register_template(
    name="exaone",
    format_user=StringFormatter(slots=["[|user|]{{content}}\n[|assistant|]"]),
    format_assistant=StringFormatter(slots=["{{content}}", {"eos_token"}, "\n"]),
    format_system=StringFormatter(slots=["[|system|]{{content}}[|endofturn|]\n"]),
)


register_template(
    name="falcon",
    format_user=StringFormatter(slots=["User: {{content}}\nFalcon:"]),
    format_assistant=StringFormatter(slots=["{{content}}\n"]),
    efficient_eos=True,
)


# copied from chatml template
register_template(