File size: 1,072 Bytes
7155cf2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import os
import json
def get_answer_prompt():
answer_prompt_data = []
with open("/mnt/lyc/wuxinrui/Qwen2.5-Math/evaluation/data/math500/test.jsonl", "r") as f:
for line in f:
data = json.loads(line)
answer = data["answer"]
problem = data["problem"]
answer_prompt = f"The answer to this question is {answer}. Based on the answer and the constraints of the thought chain length, you should deduce the most logical reasoning process. Note: During the thought process, you should pretend not to have seen the answer, but you must rationally infer the correct answer mentioned earlier based on the content of the thought chain."
data['problem'] = problem+answer_prompt
answer_prompt_data.append(data)
with open("/mnt/lyc/wuxinrui/Qwen2.5-Math/evaluation/data/math500_answer_prompt/test.jsonl", "w") as f:
for data in answer_prompt_data:
f.write(json.dumps(data, ensure_ascii=False) + "\n")
if __name__ == "__main__":
get_answer_prompt()
|