File size: 517 Bytes
9963a74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)