Skip to content

Commit

Permalink
Retry on HF Hub error when streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosasko committed Apr 26, 2024
1 parent f96e74d commit 20ed0a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/datasets/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from aiohttp.client_exceptions import ClientError
from fsspec.core import strip_protocol, url_to_fs
from fsspec.utils import can_be_local
from huggingface_hub.utils import EntryNotFoundError, insecure_hashlib
from huggingface_hub.utils import EntryNotFoundError, HfHubHTTPError, insecure_hashlib
from packaging import version

from .. import __version__, config
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def read_with_retries(*args, **kwargs):
try:
out = read(*args, **kwargs)
break
except (ClientError, TimeoutError) as err:
except (HfHubHTTPError, ClientError, TimeoutError) as err:
disconnect_err = err
logger.warning(
f"Got disconnected from remote data host. Retrying in {config.STREAMING_READ_RETRY_INTERVAL}sec [{retry}/{max_retries}]"
Expand Down

0 comments on commit 20ed0a4

Please sign in to comment.