mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-27 11:46:04 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user