fix: prompt phi (#1845) [skip ci]
* corecting phi system prompt * phi test * update * add test
This commit is contained in:
@@ -65,8 +65,10 @@ class AlpacaPrompter(Prompter):
|
||||
self.system_format = "<|im_start|>system\n{system}<|im_end|>\n"
|
||||
elif self.prompt_style == PromptStyle.PHI.value:
|
||||
self.turn_format = "<|user|>\n{instruction}<|end|>{input}<|assistant|>"
|
||||
self.turn_no_input_format = "<|user|>\n{instruction}<|end|><|assistant|>"
|
||||
self.system_format = "<|system|>{system}\n"
|
||||
self.turn_no_input_format = (
|
||||
"<|user|>\n{instruction}<|end|>\n<|assistant|>\n"
|
||||
)
|
||||
self.system_format = "<|system|>\n{system}<|end|>\n"
|
||||
|
||||
def _build_result(self, instruction, input_text, output):
|
||||
# returns the full prompt from instruction and optional input
|
||||
|
||||
@@ -42,6 +42,19 @@ class AlpacaPrompterTest(unittest.TestCase):
|
||||
assert "USER:" not in res
|
||||
assert "ASSISTANT:" not in res
|
||||
|
||||
def test_prompt_style_w_phi(self):
|
||||
prompter = AlpacaPrompter(prompt_style=PromptStyle.PHI.value)
|
||||
res = next(prompter.build_prompt("tell me a joke about the following"))
|
||||
assert (
|
||||
"""<|system|>
|
||||
Below is an instruction that describes a task. Write a response that appropriately completes the request.<|end|>
|
||||
<|user|>
|
||||
tell me a joke about the following<|end|>
|
||||
<|assistant|>
|
||||
"""
|
||||
== res
|
||||
)
|
||||
|
||||
def test_prompt_style_w_chat(self):
|
||||
prompter = AlpacaPrompter(prompt_style=PromptStyle.CHAT.value)
|
||||
res = next(
|
||||
|
||||
Reference in New Issue
Block a user