use local files for huggingface ,odel

This commit is contained in:
makaveli10
2023-05-22 16:17:09 +08:00
parent d6446916f6
commit e62dfbf1af
+6 -1
View File
@@ -82,6 +82,7 @@ class WhisperModel:
cpu_threads: int = 0,
num_workers: int = 1,
download_root: Optional[str] = None,
local_files_only: bool = True,
):
"""Initializes the Whisper model.
@@ -111,7 +112,11 @@ class WhisperModel:
if os.path.isdir(model_size_or_path):
model_path = model_size_or_path
else:
model_path = download_model(model_size_or_path, download_root)
model_path = download_model(
model_size_or_path,
local_files_only=local_files_only,
cache_dir=download_root,
)
self.model = ctranslate2.models.Whisper(
model_path,