Spaces:
Paused
Paused
Fabrice-TIERCELIN
commited on
Commit
•
d45af54
1
Parent(s):
ccde449
Upload builder.py
Browse files- llava/model/builder.py +11 -0
llava/model/builder.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from .clip_encoder import CLIPVisionTower
|
3 |
+
|
4 |
+
|
5 |
+
def build_vision_tower(vision_tower_cfg, **kwargs):
|
6 |
+
vision_tower = getattr(vision_tower_cfg, 'mm_vision_tower', getattr(vision_tower_cfg, 'vision_tower', None))
|
7 |
+
is_absolute_path_exists = os.path.exists(vision_tower)
|
8 |
+
if is_absolute_path_exists or vision_tower.startswith("openai") or vision_tower.startswith("laion"):
|
9 |
+
return CLIPVisionTower(vision_tower, args=vision_tower_cfg, **kwargs)
|
10 |
+
|
11 |
+
raise ValueError(f'Unknown vision tower: {vision_tower}')
|