File size: 1,104 Bytes
375239b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
import json
import csv

if __name__ == '__main__':
    solution_file = 'solution_.csv'
    answer_dict_file_phase1 = '/system/user/publicdata/LMM_benchmarks/MMFM_challenge_final/doc-vl-eval/answer_dicts/coverted_output_test_all_datasets.json'
    answer_dict_file_phase2 = '/system/user/publicdata/LMM_benchmarks/MMFM_challenge_final/doc-vl-eval/answer_dicts/converted_output_test_private_for_mixtral_eval.json'
    with open(answer_dict_file_phase1, 'r') as f:
        answer_dict_phase1 = json.load(f)
    with open(answer_dict_file_phase2, 'r') as f:
        answer_dict_phase2 = json.load(f)

    answer_dict = {**answer_dict_phase1, **answer_dict_phase2}
    solution_file = 'MMFM_Challenge_solution.csv'
    header = ['id', 'pred', 'split']
    with open(solution_file, 'w', newline='') as f:
        writer = csv.writer(f)
        writer.writerow(header)
        for sample_key, data_dict in answer_dict.items():
            items = sample_key.split('_')
            GT = data_dict['ground_truth']
            id_ = '_'.join(items[:-1])
            writer.writerow([id_, GT, 'public'])


    t = 1