From e66da375c82e55ac93664889f787b246c772f45a Mon Sep 17 00:00:00 2001 From: Jash Shah Date: Fri, 8 May 2026 23:18:42 -0700 Subject: [PATCH] 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. --- src/lerobot/rl/learner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lerobot/rl/learner.py b/src/lerobot/rl/learner.py index 41cfd8c03..0440d569f 100644 --- a/src/lerobot/rl/learner.py +++ b/src/lerobot/rl/learner.py @@ -125,7 +125,8 @@ def train_cli(cfg: TrainRLServerPipelineConfig): if not use_threads(cfg): import torch.multiprocessing as mp - mp.set_start_method("spawn") + if mp.get_start_method(allow_none=True) is None: + mp.set_start_method("spawn") # Use the job_name from the config train(