Commit ·
38b23dd
1
Parent(s): 8728571
Pre-install flag added in README.md
Browse files- README.md +1 -0
- app.py +2 -2
- models/llava_video.py +1 -0
- pre-install.sh +9 -0
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -9,6 +9,7 @@ app_file: app.py
|
|
| 9 |
python_version: "3.10"
|
| 10 |
pinned: false
|
| 11 |
license: apache-2.0
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 9 |
python_version: "3.10"
|
| 10 |
pinned: false
|
| 11 |
license: apache-2.0
|
| 12 |
+
preinstall: "bash pre-install.sh"
|
| 13 |
---
|
| 14 |
|
| 15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -37,7 +37,7 @@ print("Model loaded.")
|
|
| 37 |
VIDEO_IDS = sorted([
|
| 38 |
os.path.splitext(f)[0]
|
| 39 |
for f in os.listdir(VIDEO_DIR)
|
| 40 |
-
if f.endswith(".
|
| 41 |
])
|
| 42 |
|
| 43 |
# ----------------------
|
|
@@ -46,7 +46,7 @@ VIDEO_IDS = sorted([
|
|
| 46 |
def get_video_path(video_id: str):
|
| 47 |
if not video_id:
|
| 48 |
return None
|
| 49 |
-
path = os.path.join(VIDEO_DIR, video_id + ".
|
| 50 |
return path if os.path.exists(path) else None
|
| 51 |
|
| 52 |
# ----------------------
|
|
|
|
| 37 |
VIDEO_IDS = sorted([
|
| 38 |
os.path.splitext(f)[0]
|
| 39 |
for f in os.listdir(VIDEO_DIR)
|
| 40 |
+
if f.endswith(".mp4")
|
| 41 |
])
|
| 42 |
|
| 43 |
# ----------------------
|
|
|
|
| 46 |
def get_video_path(video_id: str):
|
| 47 |
if not video_id:
|
| 48 |
return None
|
| 49 |
+
path = os.path.join(VIDEO_DIR, video_id + ".mp4")
|
| 50 |
return path if os.path.exists(path) else None
|
| 51 |
|
| 52 |
# ----------------------
|
models/llava_video.py
CHANGED
|
@@ -56,6 +56,7 @@ class LLaVAVideoModel(BaseVideoModel):
|
|
| 56 |
base_model,
|
| 57 |
torch_dtype=torch_dtype,
|
| 58 |
device_map=device_map,
|
|
|
|
| 59 |
)
|
| 60 |
) # Add any other thing you want to pass in llava_model_args
|
| 61 |
self.model.eval()
|
|
|
|
| 56 |
base_model,
|
| 57 |
torch_dtype=torch_dtype,
|
| 58 |
device_map=device_map,
|
| 59 |
+
attn_implementation=attn_implementation,
|
| 60 |
)
|
| 61 |
) # Add any other thing you want to pass in llava_model_args
|
| 62 |
self.model.eval()
|
pre-install.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Pre-install script for HF Spaces
|
| 3 |
+
# This installs llava without dependencies to avoid version conflicts
|
| 4 |
+
|
| 5 |
+
echo "Installing LLaVA-NeXT without dependencies..."
|
| 6 |
+
pip install --no-deps git+https://github.com/LLaVA-VL/LLaVA-NeXT.git
|
| 7 |
+
|
| 8 |
+
echo "LLaVA-NeXT installed successfully without dependency resolution"
|
| 9 |
+
|
requirements.txt
CHANGED
|
@@ -15,7 +15,8 @@ h11==0.16.0
|
|
| 15 |
hf-xet==1.2.0
|
| 16 |
hf_transfer==0.1.8
|
| 17 |
huggingface-hub>=0.21.0,<1.0
|
| 18 |
-
llava @ git+https://github.com/LLaVA-VL/LLaVA-NeXT.git#egg=llava
|
|
|
|
| 19 |
matplotlib==3.10.8
|
| 20 |
matplotlib-inline==0.2.1
|
| 21 |
mpmath==1.3.0
|
|
|
|
| 15 |
hf-xet==1.2.0
|
| 16 |
hf_transfer==0.1.8
|
| 17 |
huggingface-hub>=0.21.0,<1.0
|
| 18 |
+
# llava @ git+https://github.com/LLaVA-VL/LLaVA-NeXT.git#egg=llava
|
| 19 |
+
# NOTE: LLaVA is installed via pre-install.sh without dependencies to avoid conflicts
|
| 20 |
matplotlib==3.10.8
|
| 21 |
matplotlib-inline==0.2.1
|
| 22 |
mpmath==1.3.0
|