Skip to content

Faster Whisper transcription with CTranslate2

Offload retry logic to hf hub (#1382)

Mahmoud Ashraf00a5b26b1f09
diff --git a/faster_whisper/utils.py b/faster_whisper/utils.py
index fabb224..8ddbb49 100644
--- a/faster_whisper/utils.py
+++ b/faster_whisper/utils.py
@@ -5,7 +5,6 @@ import re
from typing import List, Optional, Union
import huggingface_hub
-import requests
from tqdm.auto import tqdm
@@ -114,24 +113,7 @@ def download_model(
if use_auth_token is not None:
kwargs["token"] = use_auth_token
- try:
- return huggingface_hub.snapshot_download(repo_id, **kwargs)
- except (
- huggingface_hub.utils.HfHubHTTPError,
- requests.exceptions.ConnectionError,
- ) as exception:
- logger = get_logger()
- logger.warning(
- "An error occured while synchronizing the model %s from the Hugging Face Hub:\n%s",
- repo_id,
- exception,
- )
- logger.warning(
- "Trying to load the model directly from the local cache, if it exists."
- )
-
- kwargs["local_files_only"] = True
- return huggingface_hub.snapshot_download(repo_id, **kwargs)
+ return huggingface_hub.snapshot_download(repo_id, **kwargs)
def format_timestamp(
diff --git a/requirements.txt b/requirements.txt
index 1b61b2c..9a15d6a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
ctranslate2>=4.0,<5
-huggingface_hub>=0.13
+huggingface_hub>=0.21
tokenizers>=0.13,<1
onnxruntime>=1.14,<2
av>=11