Skip to content

Commit df6f403

Browse files
author
wuhuxiao
committed
midify prompt
1 parent 5a37f34 commit df6f403

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

examples/offline_inference_blend.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ def pad_rag_chunks(token_ids, block_size, pad_id, end_id):
169169
return padded
170170

171171

172-
systemPrompt = """
173-
You are a helpful assistant.
174-
Please read the following Passages and answer the Question below.
175-
"""
172+
systemPrompt = "Answer the question based on the given passages. Only give me the answer and do not output any other words.\n\nThe following are given passages.\n"
176173

177174

178175
def main():
@@ -198,7 +195,7 @@ def main():
198195
r"Passage\s+(\d+):(.*?)(?=Passage\s+\d+:|$)", dataset_row["context"], re.S
199196
)
200197
chunks = [f"Passage {i}:{passages[i][1]}" for i in range(len(passages))]
201-
question = "\n Question: " + dataset_row["input"] + "Answer within 5 words."
198+
question = f"\n\nAnswer the question based on the given passages. Answer the question within 5 words. Do NOT repeat the question or output any other words. Question: {dataset_row["input"]}\nAnswer:"
202199
origin_sys_prompt_ids = tokenizer.encode(systemPrompt)
203200
padded_sys_prompt_ids = pad_rag_chunks(
204201
origin_sys_prompt_ids, block_size, chunk_pad_token_id, chunk_end_token_id

0 commit comments

Comments
 (0)