Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -104,6 +104,13 @@ class WhisperBase(ABC):
|
|
| 104 |
start_time = datetime.now()
|
| 105 |
params = WhisperParameters.as_value(*whisper_params)
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
if params.lang is None:
|
| 108 |
pass
|
| 109 |
elif params.lang == "Automatic Detection":
|
|
@@ -166,7 +173,7 @@ class WhisperBase(ABC):
|
|
| 166 |
progress,
|
| 167 |
*astuple(params)
|
| 168 |
)
|
| 169 |
-
if
|
| 170 |
self.offload()
|
| 171 |
|
| 172 |
if params.vad_filter:
|
|
@@ -187,7 +194,7 @@ class WhisperBase(ABC):
|
|
| 187 |
transcribed_result=result,
|
| 188 |
device=params.diarization_device
|
| 189 |
)
|
| 190 |
-
if
|
| 191 |
self.diarizer.offload()
|
| 192 |
|
| 193 |
self.cache_parameters(
|
|
|
|
| 104 |
start_time = datetime.now()
|
| 105 |
params = WhisperParameters.as_value(*whisper_params)
|
| 106 |
|
| 107 |
+
# Get the offload params
|
| 108 |
+
default_params = load_yaml(DEFAULT_PARAMETERS_CONFIG_PATH)
|
| 109 |
+
whisper_params = default_params["whisper"]
|
| 110 |
+
diarization_params = default_params["diarization"]
|
| 111 |
+
bool_whisper_enable_offload = whisper_params["enable_offload"]
|
| 112 |
+
bool_diarization_enable_offload = diarization_params["enable_offload"]
|
| 113 |
+
|
| 114 |
if params.lang is None:
|
| 115 |
pass
|
| 116 |
elif params.lang == "Automatic Detection":
|
|
|
|
| 173 |
progress,
|
| 174 |
*astuple(params)
|
| 175 |
)
|
| 176 |
+
if bool_whisper_enable_offload:
|
| 177 |
self.offload()
|
| 178 |
|
| 179 |
if params.vad_filter:
|
|
|
|
| 194 |
transcribed_result=result,
|
| 195 |
device=params.diarization_device
|
| 196 |
)
|
| 197 |
+
if bool_diarization_enable_offload:
|
| 198 |
self.diarizer.offload()
|
| 199 |
|
| 200 |
self.cache_parameters(
|