Skip to content

Commit 69c600c

Browse files
authored
[Conv] Add tinyLlama v1.0 conv template (#2530)
* [Conv] Add tinyLlama v1.0 conv template * Fix lint
1 parent 9d16fec commit 69c600c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

python/mlc_llm/conversation_template/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
redpajama,
2323
rwkv,
2424
stablelm,
25+
tinyllama,
2526
wizardlm,
2627
)
2728
from .registry import ConvTemplateRegistry
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""Tiny Llama default templates"""
2+
3+
from mlc_llm.protocol.conversation_protocol import Conversation, MessagePlaceholders
4+
5+
from .registry import ConvTemplateRegistry
6+
7+
# TinyLlama v1.0
8+
ConvTemplateRegistry.register_conv_template(
9+
Conversation(
10+
name="tinyllama_v1_0",
11+
system_template=f"<|system|>\n{MessagePlaceholders.SYSTEM.value}</s>",
12+
system_message="You are a helpful chatbot.",
13+
roles={"user": "<|user|>", "assistant": "<|assistant|>"},
14+
seps=["</s>"],
15+
role_content_sep="\n",
16+
role_empty_sep="\n",
17+
stop_str=["</s>"],
18+
stop_token_ids=[2],
19+
)
20+
)

python/mlc_llm/interface/gen_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,5 @@ def gen_config( # pylint: disable=too-many-locals,too-many-arguments,too-many-b
273273
"orion",
274274
"llava",
275275
"hermes2_pro_llama3",
276+
"tinyllama_v1_0",
276277
}

0 commit comments

Comments
 (0)