Skip to content

Commit a175d44

Browse files
authored
[Python] Add Deepseek-v3 conversation template (#3097)
This PR introduces the Deepseek-v3 conversation template.
1 parent b8838a1 commit a175d44

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

python/mlc_llm/conversation_template/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from . import (
1010
cohere,
1111
deepseek,
12-
deepseek_v2,
1312
dolly,
1413
gemma,
1514
glm,

python/mlc_llm/conversation_template/deepseek.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,33 @@
1919
stop_token_ids=[100001],
2020
)
2121
)
22+
23+
# Deepseek V2
24+
ConvTemplateRegistry.register_conv_template(
25+
Conversation(
26+
name="deepseek_v2",
27+
system_template=f"{MessagePlaceholders.SYSTEM.value}",
28+
system_message="",
29+
system_prefix_token_ids=[100000],
30+
roles={"user": "User", "assistant": "Assistant"},
31+
seps=["\n\n", "<|end▁of▁sentence|>"],
32+
role_content_sep=": ",
33+
role_empty_sep=":",
34+
stop_str=["<|end▁of▁sentence|>"],
35+
stop_token_ids=[100001],
36+
)
37+
)
38+
39+
# Deepseek V3
40+
ConvTemplateRegistry.register_conv_template(
41+
Conversation(
42+
name="deepseek_v3",
43+
system_template=f"<|begin▁of▁sentence|>{MessagePlaceholders.SYSTEM.value}",
44+
system_message="You are a helpful assistant.",
45+
roles={"user": "<|User|>", "assistant": "<|Assistant|>"},
46+
seps=["", "<|end▁of▁sentence|>"],
47+
role_content_sep="",
48+
role_empty_sep="",
49+
stop_token_ids=[151643],
50+
)
51+
)

python/mlc_llm/conversation_template/deepseek_v2.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

python/mlc_llm/interface/gen_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ def gen_config( # pylint: disable=too-many-locals,too-many-arguments,too-many-b
307307
"hermes3_llama-3_1",
308308
"tinyllama_v1_0",
309309
"aya-23",
310-
"deepseek_v2",
311310
"deepseek",
311+
"deepseek_v2",
312+
"deepseek_v3",
312313
"olmo",
313314
"nemotron",
314315
}

0 commit comments

Comments
 (0)