Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,24 +12,24 @@ import torch
|
|
| 12 |
import gradio as gr
|
| 13 |
from gradio.themes.utils import colors, fonts, sizes
|
| 14 |
|
| 15 |
-
from faster_whisper import WhisperModel
|
| 16 |
from moviepy.editor import VideoFileClip
|
| 17 |
from transformers import AutoTokenizer, AutoModel
|
| 18 |
|
| 19 |
import subprocess
|
| 20 |
-
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 21 |
|
| 22 |
# ========================================
|
| 23 |
# Model Initialization
|
| 24 |
# ========================================
|
| 25 |
|
| 26 |
if gr.NO_RELOAD:
|
| 27 |
-
if torch.cuda.is_available():
|
| 28 |
-
speech_model = WhisperModel("large-v3", device="cuda", compute_type="float16")
|
| 29 |
-
else:
|
| 30 |
-
speech_model = WhisperModel("large-v3", device="cpu")
|
| 31 |
|
| 32 |
-
model_path = 'OpenGVLab/
|
| 33 |
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 35 |
model = AutoModel.from_pretrained(model_path, trust_remote_code=True).half().cuda()
|
|
|
|
| 12 |
import gradio as gr
|
| 13 |
from gradio.themes.utils import colors, fonts, sizes
|
| 14 |
|
| 15 |
+
# from faster_whisper import WhisperModel
|
| 16 |
from moviepy.editor import VideoFileClip
|
| 17 |
from transformers import AutoTokenizer, AutoModel
|
| 18 |
|
| 19 |
import subprocess
|
| 20 |
+
# subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 21 |
|
| 22 |
# ========================================
|
| 23 |
# Model Initialization
|
| 24 |
# ========================================
|
| 25 |
|
| 26 |
if gr.NO_RELOAD:
|
| 27 |
+
# if torch.cuda.is_available():
|
| 28 |
+
# speech_model = WhisperModel("large-v3", device="cuda", compute_type="float16")
|
| 29 |
+
# else:
|
| 30 |
+
# speech_model = WhisperModel("large-v3", device="cpu")
|
| 31 |
|
| 32 |
+
model_path = 'OpenGVLab/InternVideo2_5_Chat_8B'
|
| 33 |
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 35 |
model = AutoModel.from_pretrained(model_path, trust_remote_code=True).half().cuda()
|