import json | |
from tqdm import tqdm | |
f = open("/home/aiscuser/fhw/data/all_instruct_with_answers.json", "r+") | |
lines = f.readlines()[:500] | |
fw = open("/home/aiscuser/fhw/data/warrior_test.json", "w+") | |
for line in tqdm(lines): | |
d = json.loads(line) | |
item = {"messages": [{"role": "user", "content": d["instruction"]}, {"role": "assistant", "content": d["bestanswer"]}]} | |
fw.write(json.dumps(item)+"\n") | |