From e57011ea7ce42518609ae2a00a55337a23fd8bec Mon Sep 17 00:00:00 2001 From: kennymckormick Date: Tue, 24 Dec 2024 12:55:51 +0000 Subject: [PATCH] [Fix] Fix #692 --- vlmeval/tools.py | 3 +++ vlmeval/utils/mp_util.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vlmeval/tools.py b/vlmeval/tools.py index 16e80eb4..facf628b 100644 --- a/vlmeval/tools.py +++ b/vlmeval/tools.py @@ -388,6 +388,7 @@ def parse_args_eval(): parser.add_argument('data_file', type=str) parser.add_argument('--judge', type=str, default=None) parser.add_argument('--nproc', type=int, default=4) + parser.add_argument('--retry', type=int, default=None) args = parser.parse_args() return args @@ -458,6 +459,8 @@ def extract_dataset(file_name): kwargs = {'nproc': args.nproc} if args.judge is not None: kwargs['model'] = args.judge + if args.retry is not None: + kwargs['retry'] = args.retry EVAL(dataset_name=dataset, data_file=data_file, **kwargs) else: logger.error('WARNING: command error!') diff --git a/vlmeval/utils/mp_util.py b/vlmeval/utils/mp_util.py index 6b3be9a6..27e31ebe 100644 --- a/vlmeval/utils/mp_util.py +++ b/vlmeval/utils/mp_util.py @@ -58,8 +58,9 @@ def track_progress_rich( new_finished.add(idx) if keys is not None: res[keys[idx]] = results[idx] - if len(new_finished) and save is not None: - dump(res, save) + if len(new_finished): + if save is not None: + dump(res, save) pbar.update(len(new_finished)) for k in new_finished: unfinished.remove(k)