Skip to content

Commit

Permalink
Improve error messages for spawn method checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
no0p committed Feb 28, 2025
1 parent 362a90a commit 664b549
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/dolma/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def main(argv: Optional[List[str]] = None):
except RuntimeError as ex:
# method already set, check if it is set to spawn
if multiprocessing.get_start_method() != "spawn":
raise RuntimeError("Multiprocessing start method must be set to spawn") from ex
msg = f"Multiprocessing start method must be set to spawn: {multiprocessing.get_start_method()}"
raise RuntimeError(msg) from ex

parser = ArgumentParser(
prog="dolma",
Expand Down
3 changes: 2 additions & 1 deletion python/dolma/core/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ def _multiprocessing_run_all(
try:
multiprocessing.set_start_method("spawn")
except RuntimeError:
assert multiprocessing.get_start_method() == "spawn", "Multiprocessing start method must be spawn"
msg = f"Multiprocessing start method must be set to spawn but is {multiprocessing.get_start_method()}"
assert multiprocessing.get_start_method() == "spawn", msg

all_process_kwargs = all_process_kwargs or [{} for _ in all_source_paths]

Expand Down

0 comments on commit 664b549

Please sign in to comment.