Population-based methods' S2 training may stuck
Summary:
when I training S2 policy, the program seems stuck after log the training pairs (e.g. zsceval.runner.shared.overcooked_runner:train_mep:898) if the n_training_threads >= 2. The same problem occurs in HSP and MEP method.
With n_rollout_threads == 1, training runs normally.
I think it is because multiprocessing.Process() and Pipe() use fork by default on Linux. When the parent has already imported PyTorch (and other libraries that use internal locks and multithreading), fork copies the parent's memory including the current state of those locks.
I tried to Create subprocesses with the spawn context instead of the default fork. In ShareSubprocDummyBatchVecEnv.init. The training seems runs normally but be extremely slow. the log shows we need "Layout random3 Algo adaptive Exp hsp-S2-s12 Seed 1 updates 0/1250 episodes, total num timesteps 40000/50000000, FPS 13, ETA 43 days, 8:53:23." to complete the training.
Environment:
OS: Linux
Python: 3.9
CPU: 12th Gen Intel(R) Core(TM) i9-12900KF
GPU: RTX 3090
0 条评论