Skip to content

Commit 5611869

Browse files
committed
Add Phind-CodeLlama format
1 parent 115f6c2 commit 5611869

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

Diff for: backend/prompts.py

+32-1
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,44 @@ def encode_special_tokens(self):
147147
return False
148148

149149

150+
class PromptFormat_phind_codellama(PromptFormat):
151+
152+
description = "Vicuna/Alpaca-like format for Phind-CodeLlama"
153+
154+
def __init__(self):
155+
super().__init__()
156+
pass
157+
158+
def is_instruct(self):
159+
return True
160+
161+
def stop_conditions(self, tokenizer, settings):
162+
return \
163+
[tokenizer.eos_token_id, "\n### "]
164+
165+
def format(self, prompt, response, system_prompt, settings):
166+
text = ""
167+
if system_prompt and system_prompt.strip() != "":
168+
text += "### System Prompt\n"
169+
text += system_prompt
170+
text += "\n\n"
171+
text += "### User Message\n"
172+
text += prompt
173+
text += "\n\n### Assistant\n"
174+
if response:
175+
text += response
176+
text += "\n\n"
177+
return text
178+
179+
150180
prompt_formats = \
151181
{
152182
"Chat-RP": PromptFormat_raw,
153183
"Llama-chat": PromptFormat_llama,
154184
"ChatML": PromptFormat_chatml,
155185
"TinyLlama-chat": PromptFormat_tinyllama,
156-
"MistralLite": PromptFormat_mistrallite
186+
"MistralLite": PromptFormat_mistrallite,
187+
"Phind-CodeLlama": PromptFormat_phind_codellama
157188
}
158189

159190
def list_prompt_formats():

0 commit comments

Comments
 (0)