From aaddb83aa558ac3a4183d75748dc83c51e6253b1 Mon Sep 17 00:00:00 2001 From: Max Bain Date: Sat, 11 Jan 2025 17:11:21 +0000 Subject: [PATCH] switch from case to ifelse --- whisperx/asr.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/whisperx/asr.py b/whisperx/asr.py index a98dea8..43976f2 100644 --- a/whisperx/asr.py +++ b/whisperx/asr.py @@ -397,11 +397,12 @@ def load_model( print("Use manually assigned vad_model. vad_method is ignored.") vad_model = vad_model else: - match vad_method: - case "silero": - vad_model = whisperx.vads.Silero(**default_vad_options) - case "pyannote" | _: - vad_model = whisperx.vads.Pyannote(torch.device(device), use_auth_token=None, **default_vad_options) + if vad_method == "silero": + vad_model = whisperx.vads.Silero(**default_vad_options) + elif vad_method == "pyannote": + vad_model = whisperx.vads.Pyannote(torch.device(device), use_auth_token=None, **default_vad_options) + else: + raise ValueError(f"Invalid vad_method: {vad_method}") return FasterWhisperPipeline( model=model,