Skip to content

Commit 19c5a9a

Browse files
authored
Fix prompt format mismatch with huggingface (#807)
1 parent 5e8cbb7 commit 19c5a9a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

models/turbine_models/custom_models/llm_runner.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,25 @@
6161
parser.add_argument(
6262
"--chat_sys_prompt",
6363
type=str,
64-
default="""<s>[INST] <<SYS>>
65-
Be concise. You are a helpful, respectful and honest assistant. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n <</SYS>>\n\n
66-
""",
64+
default="""[INST] <<SYS>>
65+
Be concise. You are a helpful, respectful and honest assistant. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n<</SYS>>\n\n""",
6766
help="System prompt used for interactive chat mode.",
6867
)
6968

7069
B_INST, E_INST = "[INST]", "[/INST]"
7170
B_SYS, E_SYS = "<s>", "</s>"
72-
DEFAULT_CHAT_SYS_PROMPT = """<s>[INST] <<SYS>>
73-
Be concise. You are a helpful, respectful and honest assistant. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n <</SYS>>\n\n
74-
"""
71+
DEFAULT_CHAT_SYS_PROMPT = """[INST] <<SYS>>
72+
Be concise. You are a helpful, respectful and honest assistant. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n<</SYS>>\n\n"""
7573

7674

7775
def append_user_prompt(history, input_prompt):
78-
user_prompt = f"{B_INST} {input_prompt} {E_INST}"
76+
user_prompt = f"{input_prompt} {E_INST}"
7977
history += user_prompt
8078
return history
8179

8280

8381
def append_bot_prompt(history, input_prompt):
84-
user_prompt = f"{B_SYS} {input_prompt}{E_SYS} {E_SYS}"
82+
user_prompt = f"{input_prompt} {E_SYS}{B_SYS}{B_INST}"
8583
history += user_prompt
8684
return history
8785

0 commit comments

Comments
 (0)