TempCompass / merge_eval_result.py
lyx97's picture
update
19c32d4
raw
history blame
490 Bytes
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)