import json | |
input_file = "aicg.json" | |
output_file = "instruct_output.json" | |
with open(input_file, "r", encoding="utf-8") as infile: | |
input_data = json.load(infile) | |
output_data = [] | |
for item in input_data: | |
prompt_string = item["prompt string"] | |
response = item["response"] | |
output_item = { | |
"input": "", | |
"instruction": prompt_string, | |
"output": response | |
} | |
output_data.append(output_item) | |
with open(output_file, "w", encoding="utf-8") as outfile: | |
json.dump(output_data, outfile, indent=4) | |