Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions src/datasets/arrow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,19 @@ def map(
if keep_in_memory and cache_file_name is not None:
raise ValueError("Please use either `keep_in_memory` or `cache_file_name` but not both.")

# 7756 fix (multiprocessing hang on bad start_method)

if num_proc and num_proc > 1 :
try :
import multiprocessing as mp
if mp.get_start_method() not in ['forkserver','spawn'] :
logger.warning ("map(num_proc > 1) may hang. fallback to 1")
num_proc = 1

except :
(ImportError, RuntimeError) :
num_proc = 1

if num_proc == 0:
num_proc = None
elif num_proc is not None and num_proc < 0:
Expand Down
4 changes: 2 additions & 2 deletions src/datasets/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,8 @@ def load_dataset_builder(
features=features,
token=token,
storage_options=storage_options,
**builder_kwargs,
**config_kwargs,
**{**builder_kwargs,
**config_kwargs},
)
builder_instance._use_legacy_cache_dir_if_possible(dataset_module)

Expand Down