mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-14 15:57:27 +00:00
OAI: Add separator style fallback
Some models may return None for separator style with FastChat. Fall back to LLAMA2 if this is the case. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -16,6 +16,7 @@ from typing import Optional, List
|
||||
try:
|
||||
import fastchat
|
||||
from fastchat.model.model_adapter import get_conversation_template
|
||||
from fastchat.conversation import SeparatorStyle
|
||||
_fastchat_available = True
|
||||
except ImportError:
|
||||
_fastchat_available = False
|
||||
@@ -116,6 +117,9 @@ def get_chat_completion_prompt(model_path: str, messages: List[ChatCompletionMes
|
||||
)
|
||||
|
||||
conv = get_conversation_template(model_path)
|
||||
if conv.sep_style is None:
|
||||
conv.sep_style = SeparatorStyle.LLAMA2
|
||||
|
||||
for message in messages:
|
||||
msg_role = message.role
|
||||
if msg_role == "system":
|
||||
|
||||
Reference in New Issue
Block a user