项目文件夹

文件
wehub-resource-sync 770d92cb1f
Build Docs / Deploy Docs (push) Has been cancelled
Lint / lint (push) Has been cancelled
Windows CI / Windows (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:23:58 +08:00

86 行
3.3 KiB
Python

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
"""Deepseek default templates"""
from mlc_llm.protocol.conversation_protocol import Conversation, MessagePlaceholders
from .registry import ConvTemplateRegistry
# Deepseek
ConvTemplateRegistry.register_conv_template(
Conversation(
name="deepseek",
system_template=f"{MessagePlaceholders.SYSTEM.value}",
system_message="",
system_prefix_token_ids=[100000],
roles={"user": "User", "assistant": "Assistant"},
seps=["\n\n", "<end▁of▁sentence>"], # noqa: RUF001
role_content_sep=": ",
role_empty_sep=":",
stop_str=["<end▁of▁sentence>"], # noqa: RUF001
stop_token_ids=[100001],
)
)
# Deepseek V2
ConvTemplateRegistry.register_conv_template(
Conversation(
name="deepseek_v2",
system_template=f"{MessagePlaceholders.SYSTEM.value}",
system_message="",
system_prefix_token_ids=[100000],
roles={"user": "User", "assistant": "Assistant"},
seps=["\n\n", "<end▁of▁sentence>"], # noqa: RUF001
role_content_sep=": ",
role_empty_sep=":",
stop_str=["<end▁of▁sentence>"], # noqa: RUF001
stop_token_ids=[100001],
)
)
# DeepSeek-V3
ConvTemplateRegistry.register_conv_template(
Conversation(
name="deepseek_v3",
system_template=f"<begin▁of▁sentence>{MessagePlaceholders.SYSTEM.value}", # noqa: RUF001
system_message="You are Deepseek-V3, an AI assistant created exclusively by the Chinese "
"Company DeepSeek. You'll provide helpful, harmless, and detailed responses to all "
"user inquiries.",
roles={"user": "<User>", "assistant": "<Assistant>"}, # noqa: RUF001
seps=["", "<end▁of▁sentence>"], # noqa: RUF001
role_content_sep="",
role_empty_sep="",
stop_token_ids=[1],
)
)
# DeepSeek-R1-Distill-Qwen
ConvTemplateRegistry.register_conv_template(
Conversation(
name="deepseek_r1_qwen",
system_template=f"<begin▁of▁sentence>{MessagePlaceholders.SYSTEM.value}", # noqa: RUF001
system_message="You are Deepseek-R1, an AI assistant created exclusively by the Chinese "
"Company DeepSeek. You'll provide helpful, harmless, and detailed responses to all "
"user inquiries.",
roles={"user": "<User>", "assistant": "<Assistant>"}, # noqa: RUF001
seps=["", "<end▁of▁sentence>"], # noqa: RUF001
role_content_sep="",
role_empty_sep="",
stop_token_ids=[151643],
)
)
# DeepSeek-R1-Distill-Llama, exactly the same as DeepSeek-R1-Distill-Qwen, but different stop token
ConvTemplateRegistry.register_conv_template(
Conversation(
name="deepseek_r1_llama",
system_template=f"<begin▁of▁sentence>{MessagePlaceholders.SYSTEM.value}", # noqa: RUF001
system_message="You are Deepseek-R1, an AI assistant created exclusively by the Chinese "
"Company DeepSeek. You'll provide helpful, harmless, and detailed responses to all"
" user inquiries.",
roles={"user": "<User>", "assistant": "<Assistant>"}, # noqa: RUF001
seps=["", "<end▁of▁sentence>"], # noqa: RUF001
role_content_sep="",
role_empty_sep="",
stop_token_ids=[128001],
)
)