From 9ae62c6fc037a34782a07efcfb706b3f017267d3 Mon Sep 17 00:00:00 2001
From: Hertz <2267379130@qq.com>
Date: Sun, 4 Jan 2026 13:17:57 +0800
Subject: [PATCH] [model] support Youtu-LLM-2B (#9707)
---
README.md | 1 +
README_zh.md | 1 +
src/llamafactory/data/template.py | 15 +++++++++++++++
src/llamafactory/extras/constants.py | 15 +++++++++++++++
4 files changed, 32 insertions(+)
diff --git a/README.md b/README.md
index b530e6087..ef9cc36fe 100644
--- a/README.md
+++ b/README.md
@@ -329,6 +329,7 @@ Read technical notes:
| [StarCoder 2](https://huggingface.co/bigcode) | 3B/7B/15B | - |
| [VibeThinker-1.5B](https://huggingface.co/WeiboAI) | 1.5B | qwen3 |
| [Yi/Yi-1.5 (Code)](https://huggingface.co/01-ai) | 1.5B/6B/9B/34B | yi |
+| [Youtu-LLM](https://huggingface.co/tencent/) | 2B | youtu |
| [Yuan 2](https://huggingface.co/IEITYuan) | 2B/51B/102B | yuan |
> [!NOTE]
diff --git a/README_zh.md b/README_zh.md
index 8b786aabb..2fad20d3c 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -331,6 +331,7 @@ https://github.com/user-attachments/assets/43b700c6-a178-41db-b1f8-8190a5d3fcfc
| [StarCoder 2](https://huggingface.co/bigcode) | 3B/7B/15B | - |
| [VibeThinker-1.5B](https://huggingface.co/WeiboAI) | 1.5B | qwen3 |
| [Yi/Yi-1.5 (Code)](https://huggingface.co/01-ai) | 1.5B/6B/9B/34B | yi |
+| [Youtu-LLM](https://huggingface.co/tencent/) | 2B | youtu |
| [Yuan 2](https://huggingface.co/IEITYuan) | 2B/51B/102B | yuan |
> [!NOTE]
diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py
index d196ae388..8e8e11e41 100644
--- a/src/llamafactory/data/template.py
+++ b/src/llamafactory/data/template.py
@@ -2278,6 +2278,21 @@ register_template(
)
+register_template(
+ name="youtu",
+ format_user=StringFormatter(slots=["<|User|>{{content}}<|Assistant|>"]),
+ format_assistant=StringFormatter(slots=["{{content}}<|end_of_text|>"]),
+ format_system=StringFormatter(slots=["{{content}}"]),
+ format_function=FunctionFormatter(slots=["{{content}}"], tool_format="default"),
+ format_observation=StringFormatter(slots=["\n{{content}}\n<|Assistant|>"]),
+ format_tools=ToolFormatter(tool_format="default"),
+ format_prefix=EmptyFormatter(slots=[{"bos_token"}]),
+ stop_words=["<|end_of_text|>"],
+ replace_eos=True,
+ template_class=ReasoningTemplate,
+)
+
+
register_template(
name="yuan",
format_user=StringFormatter(slots=["{{content}}", {"token": ""}]),
diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py
index 00193c276..cf50954e9 100644
--- a/src/llamafactory/extras/constants.py
+++ b/src/llamafactory/extras/constants.py
@@ -3846,6 +3846,21 @@ register_model_group(
)
+register_model_group(
+ models={
+ "Youtu-LLM-2B-Instruct": {
+ DownloadSource.DEFAULT: "tencent/Youtu-LLM-2B",
+ DownloadSource.MODELSCOPE: "Tencent-YouTu-Research/Youtu-LLM-2B",
+ },
+ "Youtu-LLM-2B-Base": {
+ DownloadSource.DEFAULT: "tencent/Youtu-LLM-2B-Base",
+ DownloadSource.MODELSCOPE: "Tencent-YouTu-Research/Youtu-LLM-2B-Base",
+ },
+ },
+ template="youtu",
+)
+
+
register_model_group(
models={
"Yuan2-2B-Chat": {