Instance-based-FT / dataset /mawps /data_process.py
nvan13's picture
Upload folder using huggingface_hub
a0d95b0 verified
raw
history blame contribute delete
557 Bytes
import json
def read_json(file_path):
with open(file_path, 'r') as file:
data = json.load(file)
return data
def writer(data, path):
with open(path, 'w') as file:
json.dump(data, file, indent=4)
test_data_path = "testset.json"
test_data = read_json(test_data_path)
test_data_processed = []
for sample in test_data:
test_data_processed.append({
"instruction": sample["original_text"],
"input": "",
"output": "",
"answer": str(sample["ans"]),
})
writer(test_data_processed, "test.json")