From 2f1949e7a1ef908dad9454a88d21472f9ab8dbc7 Mon Sep 17 00:00:00 2001 From: Yuan Liu <30762564+YuanLiuuuuuu@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:21:58 +0800 Subject: [PATCH] [Feature]: Add mm suport for local (#169) --- .../instructblip/instructblip-mmbench.py | 2 +- .../multimodal/minigpt_4/minigpt_4_7b_mmbench.py | 2 +- opencompass/tasks/mm_infer.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configs/multimodal/instructblip/instructblip-mmbench.py b/configs/multimodal/instructblip/instructblip-mmbench.py index f4923e89..2ae74009 100644 --- a/configs/multimodal/instructblip/instructblip-mmbench.py +++ b/configs/multimodal/instructblip/instructblip-mmbench.py @@ -9,7 +9,7 @@ val_pipeline = [ std=(0.26862954, 0.26130258, 0.27577711)), dict(type='mmpretrain.PackInputs', algorithm_keys=[ - 'question', 'answer', 'category', 'l2-category', 'context', + 'question', 'category', 'l2-category', 'context', 'index', 'options_dict', 'options', 'split' ]) ] diff --git a/configs/multimodal/minigpt_4/minigpt_4_7b_mmbench.py b/configs/multimodal/minigpt_4/minigpt_4_7b_mmbench.py index 913007cc..90a6df61 100644 --- a/configs/multimodal/minigpt_4/minigpt_4_7b_mmbench.py +++ b/configs/multimodal/minigpt_4/minigpt_4_7b_mmbench.py @@ -9,7 +9,7 @@ val_pipeline = [ std=(0.26862954, 0.26130258, 0.27577711)), dict(type='mmpretrain.PackInputs', algorithm_keys=[ - 'question', 'answer', 'category', 'l2-category', 'context', + 'question', 'category', 'l2-category', 'context', 'index', 'options_dict', 'options', 'split' ]) ] diff --git a/opencompass/tasks/mm_infer.py b/opencompass/tasks/mm_infer.py index 2d52c230..5ecc1ab3 100644 --- a/opencompass/tasks/mm_infer.py +++ b/opencompass/tasks/mm_infer.py @@ -64,6 +64,20 @@ class MultimodalInferTask: evaluator_name = self.evaluator[0]['type'] return f'{model_name}-{dataset_name}-{evaluator_name}' + def get_log_path(self, file_extension: str = 'json') -> str: + """Get the path to the log file. + + Args: + file_extension (str): The file extension of the log file. + Default: 'json'. + """ + model_name = self.model['type'] + dataset_name = self.dataloader['dataset']['type'] + evaluator_name = self.evaluator[0]['type'] + + return osp.join(model_name, + f'{dataset_name}-{evaluator_name}.{file_extension}') + def get_command(self, cfg_path, template): """Get the command template for the task.