From fc549fdaef08e59c7ffe0f4a65c4c13c37939992 Mon Sep 17 00:00:00 2001 From: Roque Giordano Date: Sun, 25 Aug 2024 01:22:44 -0400 Subject: [PATCH] Adds the parameter local_files_only (default False for consistency) to whisperx.load_model so that the user can avoid downloading the file and return the path to the local cached file if it exists. --- whisperx/asr.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/whisperx/asr.py b/whisperx/asr.py index 0ccaf92b..1a848ed4 100644 --- a/whisperx/asr.py +++ b/whisperx/asr.py @@ -267,6 +267,7 @@ def load_model(whisper_arch, model : Optional[WhisperModel] = None, task="transcribe", download_root=None, + local_files_only=False, threads=4): '''Load a Whisper model for inference. Args: @@ -277,6 +278,7 @@ def load_model(whisper_arch, language: str - The language of the model. (use English for now) model: Optional[WhisperModel] - The WhisperModel instance to use. download_root: Optional[str] - The root directory to download the model to. + local_files_only: Optional[bool] - If `True`, avoid downloading the file and return the path to the local cached file if it exists. threads: int - The number of cpu threads to use per worker, e.g. will be multiplied by num workers. Returns: A Whisper pipeline. @@ -290,6 +292,7 @@ def load_model(whisper_arch, device_index=device_index, compute_type=compute_type, download_root=download_root, + local_files_only=local_files_only, cpu_threads=threads) if language is not None: tokenizer = faster_whisper.tokenizer.Tokenizer(model.hf_tokenizer, model.model.is_multilingual, task=task, language=language)