Add baichuan-2 chat format (#936)
Signed-off-by: caiyesd <caiyesd@gmail.com>
This commit is contained in:
parent
9515467439
commit
b8f29f4bf0
1 changed files with 15 additions and 0 deletions
|
@ -456,6 +456,21 @@ def format_oasst_llama(
|
|||
return ChatFormatterResponse(prompt=_prompt)
|
||||
|
||||
|
||||
@register_chat_format("baichuan-2")
|
||||
def format_baichuan2(
|
||||
messages: List[llama_types.ChatCompletionRequestMessage],
|
||||
**kwargs: Any,
|
||||
) -> ChatFormatterResponse:
|
||||
_system_template = "{system_message}"
|
||||
_roles = dict(user="<reserved_106>", assistant="<reserved_107>")
|
||||
_sep = ""
|
||||
system_message = _get_system_message(messages)
|
||||
system_message = _system_template.format(system_message=system_message)
|
||||
_messages = _map_roles(messages, _roles)
|
||||
_messages.append((_roles["assistant"], None))
|
||||
_prompt = _format_no_colon_single(system_message, _messages, _sep)
|
||||
return ChatFormatterResponse(prompt=_prompt)
|
||||
|
||||
@register_chat_format("openbuddy")
|
||||
def format_openbuddy(
|
||||
messages: List[llama_types.ChatCompletionRequestMessage],
|
||||
|
|
Loading…
Reference in a new issue