Skip to content

Commit

Permalink
Fix fsspec tqdm callback (#6749)
Browse files Browse the repository at this point in the history
* fix fsspec tqdm callback

* minor
  • Loading branch information
lhoestq authored Mar 22, 2024
1 parent f234fce commit ed2b406
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/datasets/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,12 @@ def stack_multiprocessing_download_progress_bars():

class TqdmCallback(fsspec.callbacks.TqdmCallback):
def __init__(self, tqdm_kwargs=None, *args, **kwargs):
super().__init__(tqdm_kwargs, *args, **kwargs)
self._tqdm = _tqdm # replace tqdm.tqdm by datasets.tqdm.tqdm
if config.FSSPEC_VERSION < version.parse("2024.2.0"):
super().__init__(tqdm_kwargs, *args, **kwargs)
self._tqdm = _tqdm # replace tqdm module by datasets.utils.tqdm module
else:
kwargs["tqdm_cls"] = _tqdm.tqdm
super().__init__(tqdm_kwargs, *args, **kwargs)


def fsspec_get(url, temp_file, storage_options=None, desc=None):
Expand Down

0 comments on commit ed2b406

Please sign in to comment.