[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 <zfz-960727@163.com>

* [Fix]: Fix lint

---------

Co-authored-by: bensenliu <bensenliu@tencent.com>
Co-authored-by: Fengzhe Zhou <zfz-960727@163.com>
This commit is contained in:
Yuan Liu 2023-11-04 09:50:36 +08:00 committed by GitHub
parent f25a980043
commit 6e31520128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)