From da725d0ad1539aab5666934fe13ea69ac7eb7d1a Mon Sep 17 00:00:00 2001 From: zhyncs Date: Mon, 29 Jul 2024 23:32:25 +0800 Subject: [PATCH] feat: add chat template for internlm2-chat --- python/sglang/srt/conversation.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python/sglang/srt/conversation.py b/python/sglang/srt/conversation.py index e005eee5f223..5ee121697402 100644 --- a/python/sglang/srt/conversation.py +++ b/python/sglang/srt/conversation.py @@ -436,3 +436,14 @@ def generate_chat_conv( sep2="", ) ) + +# Reference: https://github.com/InternLM/lmdeploy/blob/387bf54b4f124e72aab30ae9755f562e435d3d01/lmdeploy/model.py#L425-L442 +register_conv_template( + Conversation( + name="internlm2-chat", + system_template="<|im_start|>system\n{system_message}", + roles=("<|im_start|>user", "<|im_start|>assistant"), + sep="\n", + stop_str=["<|im_end|>", "<|action_end|>"], + ) +)