From a582a594932be9e7584afff1f266e15f2f59c383 Mon Sep 17 00:00:00 2001 From: m-bain <36994049+m-bain@users.noreply.github.com> Date: Sat, 1 Apr 2023 13:05:40 -0700 Subject: [PATCH] mkdir for torch cache in case it doesnt exist --- whisperx/vad.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/whisperx/vad.py b/whisperx/vad.py index 6fac656..0f15630 100644 --- a/whisperx/vad.py +++ b/whisperx/vad.py @@ -18,6 +18,7 @@ VAD_SEGMENTATION_URL = "https://whisperx.s3.eu-west-2.amazonaws.com/model_weight def load_vad_model(device, vad_onset, vad_offset, use_auth_token=None): model_dir = torch.hub._get_torch_home() + os.makedirs(model_dir, exist_ok = True) model_fp = os.path.join(model_dir, "whisperx-vad-segmentation.bin") if os.path.exists(model_fp) and not os.path.isfile(model_fp): raise RuntimeError(f"{model_fp} exists and is not a regular file") @@ -301,4 +302,4 @@ def merge_chunks(segments, chunk_size): "end": curr_end, "segments": seg_idxs, }) - return merged_segments \ No newline at end of file + return merged_segments