Skip to content

Commit ed2b406

Browse files
authored
Fix fsspec tqdm callback (#6749)
* fix fsspec tqdm callback * minor
1 parent f234fce commit ed2b406

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/datasets/utils/file_utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,12 @@ def stack_multiprocessing_download_progress_bars():
327327

328328
class TqdmCallback(fsspec.callbacks.TqdmCallback):
329329
def __init__(self, tqdm_kwargs=None, *args, **kwargs):
330-
super().__init__(tqdm_kwargs, *args, **kwargs)
331-
self._tqdm = _tqdm # replace tqdm.tqdm by datasets.tqdm.tqdm
330+
if config.FSSPEC_VERSION < version.parse("2024.2.0"):
331+
super().__init__(tqdm_kwargs, *args, **kwargs)
332+
self._tqdm = _tqdm # replace tqdm module by datasets.utils.tqdm module
333+
else:
334+
kwargs["tqdm_cls"] = _tqdm.tqdm
335+
super().__init__(tqdm_kwargs, *args, **kwargs)
332336

333337

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

0 commit comments

Comments
 (0)