diff --git a/src/datasets/utils/logging.py b/src/datasets/utils/logging.py index a2c3becd741..c379820143f 100644 --- a/src/datasets/utils/logging.py +++ b/src/datasets/utils/logging.py @@ -202,8 +202,6 @@ def __exit__(self, type_, value, traceback): class _tqdm_cls: - _lock = None - def __call__(self, *args, disable=False, **kwargs): if _tqdm_active and not disable: return tqdm_lib.tqdm(*args, **kwargs) @@ -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()