File size: 490 Bytes
5d57406
 
 
19c32d4
5d57406
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json, os

eval_result_path = "file/example_eval_results"
eval_result_files = [f for f in os.listdir(eval_result_path) if f.endswith('.json') and not 'merge' in f]

merged_result = {}
for fn in eval_result_files:
    task_type = fn.replace('.json', '')
    with open(f"{eval_result_path}/{fn}", "r") as f:
        merged_result[task_type] = json.load(f)

merge_file = f"{eval_result_path}/merged_result.json"
with open(merge_file, "w") as f:
    json.dump(merged_result, f, indent=4)