| 6 | |
| 7 | |
| 8 | def MMMU_result_transfer(result_path): |
| 9 | res = {} |
| 10 | result_data = load(result_path) |
| 11 | mcq = result_data['A'].notna() |
| 12 | lt = len(result_data) |
| 13 | for i in range(lt): |
| 14 | line = result_data.iloc[i] |
| 15 | if mcq[i]: |
| 16 | options = { |
| 17 | cand: line[cand] |
| 18 | for cand in string.ascii_uppercase |
| 19 | if cand in line and not pd.isna(line[cand]) |
| 20 | } |
| 21 | prediction = line['prediction'] |
| 22 | infer_prediction = can_infer(prediction, options) |
| 23 | res[line['id']] = infer_prediction |
| 24 | else: |
| 25 | res[line['id']] = line['prediction'] |
| 26 | result_json = result_path.replace('.xlsx', '.json') |
| 27 | dump(res, result_json) |
| 28 | return result_json |
| 29 | |
| 30 | |
| 31 | def MMTBench_result_transfer(eval_file, dataset='default', **judge_kwargs): |