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

rety model download locally if huggingface throws an http error. #215

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
19 changes: 13 additions & 6 deletions faster_whisper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,20 @@ def download_model(
"tokenizer.json",
"vocabulary.txt",
]
kwargs["allow_patterns"] = allow_patterns
kwargs["tqdm_class"] = disabled_tqdm

return huggingface_hub.snapshot_download(
repo_id,
allow_patterns=allow_patterns,
tqdm_class=disabled_tqdm,
**kwargs,
)
try:
return huggingface_hub.snapshot_download(
repo_id,
**kwargs,
)
except huggingface_hub.utils.HfHubHTTPError:
kwargs["local_files_only"] = True
return huggingface_hub.snapshot_download(
repo_id,
**kwargs,
)


def format_timestamp(
Expand Down