Skip to content
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
10 changes: 8 additions & 2 deletions src/datasets/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ def __exit__(self, type_, value, traceback):


class _tqdm_cls:
_lock = None
Copy link
Member Author

@lhoestq lhoestq Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it reverts #6067


def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
Expand All @@ -219,6 +217,14 @@ def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()

def __delattr__(self, attr):
"""fix for https://github.com/huggingface/datasets/issues/6066"""
try:
del self.__dict__[attr]
except KeyError:
if attr != "_lock":
raise AttributeError(attr)


tqdm = _tqdm_cls()

Expand Down