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
cf9d8efd
"examples/vscode:/vscode.git/clone" did not exist on "2389df81555ae4cc9b819393282d24eb1440dfbc"
Unverified
Commit
cf9d8efd
authored
Apr 21, 2024
by
Enrique Shockwave
Committed by
GitHub
Apr 21, 2024
Browse files
llama3 instruct template (#372)
parent
1bf1cf19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
python/sglang/lang/chat_template.py
python/sglang/lang/chat_template.py
+29
-0
No files found.
python/sglang/lang/chat_template.py
View file @
cf9d8efd
...
@@ -162,6 +162,28 @@ register_chat_template(
...
@@ -162,6 +162,28 @@ register_chat_template(
)
)
)
)
register_chat_template
(
ChatTemplate
(
name
=
"llama-3-instruct"
,
default_system_prompt
=
None
,
role_prefix_and_suffix
=
{
"system"
:
(
"<|start_header_id|>system<|end_header_id|>
\n\n
"
,
"<|eot_id|>"
,
),
"user"
:
(
"<|start_header_id|>user<|end_header_id|>
\n\n
"
,
"<|eot_id|>"
,
),
"assistant"
:
(
"<|start_header_id|>assistant<|end_header_id|>
\n\n
"
,
"<|eot_id|>"
,
),
},
stop_str
=
(
"<|eot_id|>"
,),
)
)
# Reference: https://github.com/01-ai/Yi/tree/main/VL#major-difference-with-llava
# Reference: https://github.com/01-ai/Yi/tree/main/VL#major-difference-with-llava
register_chat_template
(
register_chat_template
(
ChatTemplate
(
ChatTemplate
(
...
@@ -233,6 +255,13 @@ def match_llama2_chat(model_path: str):
...
@@ -233,6 +255,13 @@ def match_llama2_chat(model_path: str):
return
get_chat_template
(
"llama-2-chat"
)
return
get_chat_template
(
"llama-2-chat"
)
@
register_chat_template_matching_function
def
match_llama3_instruct
(
model_path
:
str
):
model_path
=
model_path
.
lower
()
if
"llama-3"
in
model_path
and
"instruct"
in
model_path
:
return
get_chat_template
(
"llama-3-instruct"
)
@
register_chat_template_matching_function
@
register_chat_template_matching_function
def
match_chat_ml
(
model_path
:
str
):
def
match_chat_ml
(
model_path
:
str
):
model_path
=
model_path
.
lower
()
model_path
=
model_path
.
lower
()
...
...
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