-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
executable file
·67 lines (61 loc) · 1.97 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import importlib
import os
import hf_transfer
from loguru import logger
import sys
import hf_transfer
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
logger.remove()
logger.add(sys.stdout, level="WARNING")
AVAILABLE_MODELS = {
"llava": "Llava",
"qwen_vl": "Qwen_VL",
"fuyu": "Fuyu",
"batch_gpt4": "BatchGPT4",
"gpt4v": "GPT4V",
"instructblip": "InstructBLIP",
"minicpm_v": "MiniCPM_V",
"llava_vid": "LlavaVid",
"videoChatGPT": "VideoChatGPT",
"llama_vid": "LLaMAVid",
"video_llava": "VideoLLaVA",
"xcomposer2_4KHD": "XComposer2_4KHD",
"claude": "Claude",
"qwen_vl_api": "Qwen_VL_API",
"llava_sglang": "LlavaSglang",
"idefics2": "Idefics2",
"internvl": "InternVLChat",
"internvl2": "InternVL2",
"gemini_api": "GeminiAPI",
"reka": "Reka",
"from_log": "FromLog",
"mplug_owl_video": "mplug_Owl",
"phi3v": "Phi3v",
"tinyllava": "TinyLlava",
"llava_hf": "LlavaHf",
"longva": "LongVA",
"llava_hf": "LlavaHf",
"longva": "LongVA",
"vila": "VILA",
"mantis": "Mantis",
"cambrian1": "Cambrian1",
"mblip": "MBlip",
"paligemma": "PaliGemma",
"llava_onevision": "Llava_OneVision",
"molmo": "Molmo",
"llama_vision": "LlamaVision",
}
for model_name, model_class in AVAILABLE_MODELS.items():
try:
exec(f"from .{model_name} import {model_class}")
except ImportError as e:
logger.warning(f"Failed to import {model_class} from {model_name}: {e}")
if os.environ.get("LMMS_EVAL_PLUGINS", None):
# Allow specifying other packages to import models from
for plugin in os.environ["LMMS_EVAL_PLUGINS"].split(","):
m = importlib.import_module(f"{plugin}.models")
for model_name, model_class in getattr(m, "AVAILABLE_MODELS").items():
try:
exec(f"from {plugin}.models.{model_name} import {model_class}")
except ImportError:
logger.warning(f"Failed to import {model_class} from {model_name}")