forked from top-quarks/ARC-solution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit-files.py
More file actions
23 lines (18 loc) · 725 Bytes
/
Copy pathsplit-files.py
File metadata and controls
23 lines (18 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import json
import os
def split_json_to_files(input_file, output_dir):
# Create output directory if it doesn't exist
os.makedirs(output_dir, exist_ok=True)
# Read the input JSON file
with open(input_file, 'r') as f:
data = json.load(f)
# Split into individual files
for task_id, task_data in data.items():
output_file = os.path.join(output_dir, f"{task_id}.json")
with open(output_file, 'w') as f:
json.dump(task_data, f, indent=2)
print(f"Split {len(data)} tasks into individual files in {output_dir}")
# Usage
input_file = '../arc4/data/arc-prize-2024/arc-agi_test_challenges.json'
output_dir = 'dataset/test'
split_json_to_files(input_file, output_dir)