Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set conditional local_files_only #405

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion modules/whisper/faster_whisper_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,21 @@ def update_model(self,
"""
progress(0, desc="Initializing Model..")
self.current_model_size = self.model_paths[model_size]

local_files_only = False
hf_prefix = "models--Systran--faster-whisper-"
official_model_path = os.path.join(self.model_dir, hf_prefix+model_size)
if ((os.path.isdir(self.current_model_size) and os.path.exists(self.current_model_size)) or
(model_size in faster_whisper.available_models() and os.path.exists(official_model_path))):
local_files_only = True

self.current_compute_type = compute_type
self.model = faster_whisper.WhisperModel(
device=self.device,
model_size_or_path=self.current_model_size,
download_root=self.model_dir,
compute_type=self.current_compute_type
compute_type=self.current_compute_type,
local_files_only=local_files_only
)

def get_model_paths(self):
Expand Down