File size: 406 Bytes
fdf190d |
1 2 3 4 5 6 7 8 9 10 |
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")
|