Spaces:
Running
on
Zero
Running
on
Zero
Update whisper_cs.py
#33
by
ssolito
- opened
- whisper_cs.py +13 -0
whisper_cs.py
CHANGED
@@ -104,6 +104,19 @@ def cleanup_temp_files(*file_paths):
|
|
104 |
if path and os.path.exists(path):
|
105 |
os.remove(path)
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
faster_model = WhisperModel(MODEL_PATH_V2_FAST, device=DEVICE, compute_type="float16")
|
108 |
|
109 |
def load_whisper_model(model_path: str):
|
|
|
104 |
if path and os.path.exists(path):
|
105 |
os.remove(path)
|
106 |
|
107 |
+
if torch.cuda.is_available():
|
108 |
+
faster_model = WhisperModel(
|
109 |
+
MODEL_PATH_V2_FAST,
|
110 |
+
device="cuda",
|
111 |
+
compute_type="float16" #"int8_float16"
|
112 |
+
)
|
113 |
+
else:
|
114 |
+
faster_model = WhisperModel(
|
115 |
+
MODEL_PATH_V2_FAST,
|
116 |
+
device="cpu",
|
117 |
+
compute_type="int8"
|
118 |
+
)
|
119 |
+
|
120 |
faster_model = WhisperModel(MODEL_PATH_V2_FAST, device=DEVICE, compute_type="float16")
|
121 |
|
122 |
def load_whisper_model(model_path: str):
|