Skip to content

Commit a71e685

Browse files
authored
[model] support hunyuan 7b (#7317)
* [Model]supported tencent-hunyuan model * [Model]supported tencent-hunyuan model(fix) * [Model]supported tencent-hunyuan model(fix)
1 parent 30038d9 commit a71e685

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/
238238
| [GPT-2](https://huggingface.co/openai-community) | 0.1B/0.4B/0.8B/1.5B | - |
239239
| [Granite 3.0-3.1](https://huggingface.co/ibm-granite) | 1B/2B/3B/8B | granite3 |
240240
| [Index](https://huggingface.co/IndexTeam) | 1.9B | index |
241+
| [Hunyuan](https://huggingface.co/tencent/) | 7B | hunyuan |
241242
| [InternLM 2-3](https://huggingface.co/internlm) | 7B/8B/20B | intern2 |
242243
| [Llama](https://github.com/facebookresearch/llama) | 7B/13B/33B/65B | - |
243244
| [Llama 2](https://huggingface.co/meta-llama) | 7B/13B/70B | llama2 |

README_zh.md

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ https://github.com/user-attachments/assets/e6ce34b0-52d5-4f3e-a830-592106c4c272
239239
| [GLM-4](https://huggingface.co/THUDM) | 9B | glm4 |
240240
| [GPT-2](https://huggingface.co/openai-community) | 0.1B/0.4B/0.8B/1.5B | - |
241241
| [Granite 3.0-3.1](https://huggingface.co/ibm-granite) | 1B/2B/3B/8B | granite3 |
242+
| [Hunyuan](https://huggingface.co/tencent/) | 7B | hunyuan |
242243
| [Index](https://huggingface.co/IndexTeam) | 1.9B | index |
243244
| [InternLM 2-3](https://huggingface.co/internlm) | 7B/8B/20B | intern2 |
244245
| [Llama](https://github.com/facebookresearch/llama) | 7B/13B/33B/65B | - |

src/llamafactory/data/template.py

+10
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,16 @@ def get_template_and_fix_tokenizer(tokenizer: "PreTrainedTokenizer", data_args:
876876
)
877877

878878

879+
register_template(
880+
name="hunyuan",
881+
format_user=StringFormatter(slots=["<|bos|>user\n{{content}}<|eos|>\n<|bos|>assistant\n"]),
882+
format_assistant=StringFormatter(slots=["{{content}}<|eos|>\n"]),
883+
format_system=StringFormatter(slots=["<|bos|>system\n{{content}}<|eos|>\n"]),
884+
format_prefix=EmptyFormatter(slots=["<|bos|>"] ),
885+
stop_words=["<|eos|>"]
886+
)
887+
888+
879889
register_template(
880890
name="intern",
881891
format_user=StringFormatter(slots=["<|User|>:{{content}}\n<|Bot|>:"]),

src/llamafactory/extras/constants.py

+11
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,17 @@ def register_model_group(
809809
)
810810

811811

812+
register_model_group(
813+
models={
814+
"Hunyuan-7B-Instruct": {
815+
DownloadSource.DEFAULT: "tencent/Hunyuan-7B-Instruct",
816+
DownloadSource.MODELSCOPE: "AI-ModelScope/Hunyuan-7B-Instruct",
817+
},
818+
},
819+
template="hunyuan",
820+
)
821+
822+
812823
register_model_group(
813824
models={
814825
"Index-1.9B-Base": {

0 commit comments

Comments
 (0)