Skip to content

Commit

Permalink
Ignore parallel warning in map_nested (huggingface#6148)
Browse files Browse the repository at this point in the history
ignore parallel warning in map_,nested
  • Loading branch information
lhoestq committed Aug 17, 2023
1 parent 664a1cb commit a7f8d90
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/datasets/utils/py_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import queue
import re
import types
import warnings
from contextlib import contextmanager
from dataclasses import fields, is_dataclass
from io import BytesIO as StringIO
Expand Down Expand Up @@ -465,7 +466,13 @@ def map_nested(
for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
]
else:
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message=".* is experimental and might be subject to breaking changes in the future\\.$",
category=UserWarning,
)
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)

if isinstance(data_struct, dict):
return dict(zip(data_struct.keys(), mapped))
Expand Down

0 comments on commit a7f8d90

Please sign in to comment.