Skip to content

Add QWQ-32b prompt format #76

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
20 changes: 20 additions & 0 deletions backend/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,25 @@ def format(self, prompt, response, system_prompt, settings):
def context_bos(self):
return True

class PromptFormat_qwq(PromptFormat_chatml):

description = "QWQ format with <think> tokens"

def format(self, prompt, response, system_prompt, settings):
text = ""
if system_prompt and system_prompt.strip() != "":
text += "<|im_start|>system\n"
text += system_prompt
text += "\n<|im_end|>\n"
text += "<|im_start|>user\n"
text += prompt
text += "<|im_end|>\n"
text += "<|im_start|>assistant\n<think>\n"
if response:
text += response
text += "<|im_end|>\n"
return text


class PromptFormat_tinyllama(PromptFormat_chatml):

Expand Down Expand Up @@ -536,6 +555,7 @@ def context_bos(self):
prompt_formats = \
{
"Chat-RP": PromptFormat_raw,
"QwQ-32b": PromptFormat_qwq,
"Llama-chat": PromptFormat_llama,
"Llama3-instruct": PromptFormat_llama3,
"ChatML": PromptFormat_chatml,
Expand Down