Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
4a1c6ae2
Unverified
Commit
4a1c6ae2
authored
May 07, 2024
by
YoungJoong Noah Kim
Committed by
GitHub
May 07, 2024
Browse files
Add Cohere Command R chat template (#411)
parent
14522e6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
python/sglang/lang/chat_template.py
python/sglang/lang/chat_template.py
+20
-0
No files found.
python/sglang/lang/chat_template.py
View file @
4a1c6ae2
...
@@ -227,6 +227,19 @@ register_chat_template(
...
@@ -227,6 +227,19 @@ register_chat_template(
)
)
)
)
register_chat_template
(
ChatTemplate
(
name
=
"c4ai-command-r"
,
default_system_prompt
=
None
,
role_prefix_and_suffix
=
{
"system"
:
(
"<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>"
,
"<|END_OF_TURN_TOKEN|>"
),
"user"
:
(
"<|START_OF_TURN_TOKEN|><|USER_TOKEN|>"
,
"<|END_OF_TURN_TOKEN|>"
),
"assistant"
:
(
"<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>"
,
"<|END_OF_TURN_TOKEN|>"
),
},
style
=
ChatTemplateStyle
.
PLAIN
,
)
)
@
register_chat_template_matching_function
@
register_chat_template_matching_function
def
match_dbrx
(
model_path
:
str
):
def
match_dbrx
(
model_path
:
str
):
...
@@ -287,6 +300,13 @@ def match_gemma_it(model_path: str):
...
@@ -287,6 +300,13 @@ def match_gemma_it(model_path: str):
return
get_chat_template
(
"gemma-it"
)
return
get_chat_template
(
"gemma-it"
)
@
register_chat_template_matching_function
def
match_c4ai_command_r
(
model_path
:
str
):
model_path
=
model_path
.
lower
()
if
"c4ai-command-r"
in
model_path
:
return
get_chat_template
(
"c4ai-command-r"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
messages
=
[
messages
=
[
{
"role"
:
"system"
,
"content"
:
None
},
# None means default
{
"role"
:
"system"
,
"content"
:
None
},
# None means default
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment