From 6e31520128454afbb6665cd5b50eb6dc621b2dfa Mon Sep 17 00:00:00 2001 From: Yuan Liu <30762564+YuanLiuuuuuu@users.noreply.github.com> Date: Sat, 4 Nov 2023 09:50:36 +0800 Subject: [PATCH] [Feature]: To be compatible with the latest version of MiniGPT-4 (#539) * [Feature]: To be compatible with the latest version of MiniGPT-4 * [Feature]: User try and except Co-authored-by: Fengzhe Zhou * [Fix]: Fix lint --------- Co-authored-by: bensenliu Co-authored-by: Fengzhe Zhou --- opencompass/multimodal/models/minigpt_4/minigpt_4.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opencompass/multimodal/models/minigpt_4/minigpt_4.py b/opencompass/multimodal/models/minigpt_4/minigpt_4.py index 3c0986d9..f722526c 100644 --- a/opencompass/multimodal/models/minigpt_4/minigpt_4.py +++ b/opencompass/multimodal/models/minigpt_4/minigpt_4.py @@ -27,7 +27,13 @@ def load_package(): current_folder_path = os.path.dirname(current_file_path) sys.path.append(os.path.join(current_folder_path, 'MiniGPT-4')) # noqa - from minigpt4.models.mini_gpt4 import MiniGPT4 + + try: + # the latest version of MiniGPT4 + from minigpt4.models.minigpt4 import MiniGPT4 + except ImportError: + # the old version of MiniGPT4 + from minigpt4.models.mini_gpt4 import MiniGPT4 sys.path.pop(-1)