diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 89b70d114..650c7d34c 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -1274,6 +1274,30 @@ register_template( ) +# The following two templates are copied from the official Hy-MT2 chat templates: +# https://github.com/Tencent-Hunyuan/Hy-MT2/blob/main/train/llama_factory_support/hy_dense_template.py +register_template( + name="hy_dense_1_8b", + format_user=StringFormatter(slots=["<|hy_User|>{{content}}"]), + format_assistant=StringFormatter(slots=["<|hy_Assistant|>{{content}}"]), + format_system=StringFormatter(slots=["{{content}}<|hy_place▁holder▁no▁3|>"]), + format_prefix=EmptyFormatter(slots=[{"bos_token"}]), + stop_words=["<|hy_place▁holder▁no▁2|>"], + efficient_eos=True, +) + + +register_template( + name="hy_dense_7b", + format_user=StringFormatter(slots=["{{content}}<|extra_0|>"]), + format_assistant=StringFormatter(slots=["{{content}}"]), + format_system=StringFormatter(slots=["{{content}}<|extra_4|>"]), + format_prefix=EmptyFormatter(slots=[{"bos_token"}]), + stop_words=["<|eos|>"], + efficient_eos=True, +) + + register_template( name="intern2", format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index 9fd5a760f..fea90598c 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -1248,6 +1248,28 @@ register_model_group( ) +register_model_group( + models={ + "Hy-MT2-1.8B-Instruct": { + DownloadSource.DEFAULT: "tencent/Hy-MT2-1.8B", + DownloadSource.MODELSCOPE: "Tencent-Hunyuan/Hy-MT2-1.8B", + }, + }, + template="hy_dense_1_8b", +) + + +register_model_group( + models={ + "Hy-MT2-7B-Instruct": { + DownloadSource.DEFAULT: "tencent/Hy-MT2-7B", + DownloadSource.MODELSCOPE: "Tencent-Hunyuan/Hy-MT2-7B", + }, + }, + template="hy_dense_7b", +) + + register_model_group( models={ "HY-MT1.5-1.8B-Instruct": {