diff --git a/opencompass/multimodal/models/minigpt_4/minigpt_4.py b/opencompass/multimodal/models/minigpt_4/minigpt_4.py index ebc5b294f..9376da13e 100644 --- a/opencompass/multimodal/models/minigpt_4/minigpt_4.py +++ b/opencompass/multimodal/models/minigpt_4/minigpt_4.py @@ -27,10 +27,12 @@ def load_package(): current_folder_path = os.path.dirname(current_file_path) sys.path.append(os.path.join(current_folder_path, 'MiniGPT-4')) # noqa - # to be compatible with the latest version - # if you are using the old version, please use the following line - # 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 + rom minigpt4.models.mini_gpt4 import MiniGPT4 sys.path.pop(-1)