Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/multimodal/evaluation/evaluate_mathvista.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

import argparse
import json
import re
Expand Down Expand Up @@ -73,7 +75,8 @@ def extract_answer(text):

def compute_mathvista_accuracy(result_file):
"""Compute MathVista accuracy."""
merged_results = json.load(open(result_file))
with open(result_file, "r") as f:
merged_results = json.load(f)

vqa = VQAEval(vqa=None, vqaRes=None)
acc = 0
Expand Down
5 changes: 4 additions & 1 deletion examples/multimodal/evaluation/evaluate_ocrbench.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

import argparse
import json

Expand Down Expand Up @@ -32,7 +34,8 @@ def merge_input_files(input_path):

def compute_ocrbench_score(result_file):
"""Compute OCRBench score."""
merged_results = json.load(open(result_file))
with open(result_file, "r") as f:
merged_results = json.load(f)

# OCRBench score calculation is adopted from https://github.com/Yuliang-Liu/MultimodalOCR/blob/1b7713f44c91f30f64efb6d3e494c416861ef15f/example.py#L1
# MIT License. Copyright (c) 2023 Yuliang Liu
Expand Down
5 changes: 4 additions & 1 deletion examples/multimodal/evaluation/evaluate_video_mvbench.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

import argparse
import json

Expand Down Expand Up @@ -98,7 +100,8 @@ def combine_all_res(acc_dict):
def mvbench_eval(input_path):
result_file_path = merge_input_files(input_path)

merged_results = json.load(open(result_file_path))
with open(result_file_path, "r") as f:
merged_results = json.load(f)
acc_dict = create_result_dict(merged_results)

return combine_all_res(acc_dict)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

import argparse
import json

Expand Down Expand Up @@ -83,7 +85,8 @@ def compute_all_acc(result_list):
def phys_game_bench_eval(input_path):
result_file_path = merge_input_files(input_path)

merged_results = json.load(open(result_file_path))
with open(result_file_path, "r") as f:
merged_results = json.load(f)

return compute_all_acc(merged_results)

Expand Down
5 changes: 4 additions & 1 deletion examples/multimodal/evaluation/evaluate_vqav2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

import argparse
import json
from typing import List
Expand Down Expand Up @@ -93,7 +95,8 @@ def is_number(n: str):

def compute_vqa_accuracy(result_file, task):
"""Compute VQA accuracy."""
merged_results = json.load(open(result_file))
with open(result_file, "r") as f:
merged_results = json.load(f)

vqa = VQAEval(vqa=None, vqaRes=None)
all_acc = []
Expand Down
Loading
Loading