Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update openai_api_server_vllm.py #176

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/openai_server_demo/openai_api_server_vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
register_conv_template(
Conversation(
name="chinese-llama-alpaca",
system="Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n",
system_message="Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n",
roles=("### Instruction:\n", "### Response:"),
messages=(),
offset=0,
Expand All @@ -62,7 +62,7 @@
register_conv_template(
Conversation(
name="chinese-llama-alpaca-2",
system="[INST] <<SYS>>\nYou are a helpful assistant. 你是一个乐于助人的助手。\n<</SYS>>\n\n",
system_message="[INST] <<SYS>>\nYou are a helpful assistant. 你是一个乐于助人的助手。\n<</SYS>>\n\n",
roles=("[INST]", "[/INST]"),
messages=(),
offset=0,
Expand Down Expand Up @@ -131,7 +131,7 @@ async def get_gen_prompt(request) -> str:
conv = get_conversation_template(request.model)
conv = Conversation(
name=conv.name,
system=conv.system,
system_message=conv.system_message,
roles=conv.roles,
messages=list(conv.messages), # prevent in-place modification
offset=conv.offset,
Expand All @@ -148,7 +148,7 @@ async def get_gen_prompt(request) -> str:
for message in request.messages:
msg_role = message["role"]
if msg_role == "system":
conv.system = message["content"]
conv.system_message = message["content"]
elif msg_role == "user":
conv.append_message(conv.roles[0], message["content"])
elif msg_role == "assistant":
Expand All @@ -167,7 +167,7 @@ async def get_gen_prompt_nochat(request) -> str:
conv = get_conversation_template(request.model)
conv = Conversation(
name=conv.name,
system=conv.system,
system_message=conv.system_message,
roles=conv.roles,
messages=list(conv.messages), # prevent in-place modification
offset=conv.offset,
Expand Down