fix(rl): only set multiprocessing start method if not already set

mp.set_start_method() raises RuntimeError if called more than once
(e.g., when train_cli is invoked in a process that already set the
start method via pytest, Jupyter, or another entrypoint). Guard with
get_start_method(allow_none=True) check.
This commit is contained in:
Jash Shah
2026-05-08 23:18:42 -07:00
committed by Steven Palma
parent a0eb860d1e
commit e66da375c8
+1
View File
@@ -125,6 +125,7 @@ def train_cli(cfg: TrainRLServerPipelineConfig):
if not use_threads(cfg):
import torch.multiprocessing as mp
if mp.get_start_method(allow_none=True) is None:
mp.set_start_method("spawn")
# Use the job_name from the config