Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- with open('ctga-v1.json', 'r', encoding='utf-8') as f:
- data = json.load(f)
- # Convert to the simpler format
- new_data = []
- for item in data:
- new_item = {
- 'instruction': item['task_input'].replace('{{context}}', item['context']),
- 'input': item['task_type'],
- 'output': item['task_output']
- }
- new_data.append(new_item)
- new_data_json = json.dumps(new_data, ensure_ascii=False, indent=4)
- with open('alcapa_format.json', 'w', encoding='utf-8') as f:
- f.write(new_data_json)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement