I am trying to train a peg insertion task using stable-baselines3, and I am using SubprocVecEnv. However, after training for a while (about 90000 steps), I always encounter an EOFError with remote.recv().
Could you help me look into this bug? It would be of great help to me as I have been troubled by this issue for a long time.
Sincerely,
George
To Reproduce
from stable_baselines3 import TD3
from stable_baselines3.common.vec_env import SubprocVecEnv
def make_env(env_name, seed=0, i=0, **env_args):
num_devices = torch.cuda.device_count()
assert num_devices > 0
wp_device = f"cuda:{i % num_devices}"
def _init():
env = gym.make(env_name, device=wp_device, **env_args)
return env
set_random_seed(seed)
return _init
env = SubprocVecEnv(
[
make_env(
env_name,
seed,
i,
**specified_env_args,
)
for i in range(parallel_num)
]
)
Relevant log output / Error message
Traceback (most recent call last):
File "/home/george/桌面/KCL/ManiSkill-ViTac2024/scripts/universal_training_script.py", line 168, in
model.learn(
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/site-packages/stable_baselines3/td3/td3.py", line 222, in learn
return super().learn(
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/site-packages/stable_baselines3/common/off_policy_algorithm.py", line 312, in learn
rollout = self.collect_rollouts (
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/site-packages/stable_baselines3/common/off_policy_algorithm.py", line 544, in collect_rollouts
new_obs, rewards, dones, infos = env.step(actions)
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/site-packages/stable_baselines3/common/vec_env/base_vec_env.py", line 197, in step
return self.step_wait()
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 132, in step_wait
results = [remote.recv() for remote in self.remotes]
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 132, in
results = [remote.recv() for remote in self.remotes]
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/multiprocessing/connection.py", line 255, in recv
buf = self._recv_bytes()
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/multiprocessing/connection.py", line 419, in _recv_bytes
buf = self._recv(4)
File "/home/george/miniconda3/envs/mani_vitac/lib/python3.10/multiprocessing/connection.py", line 388, in _recv
raise EOFError
EOFError
Checklist
[x] My issue does not relate to a custom gym environment. (Use the custom gym env template instead)
[X] I have checked that there is no similar issue in the repo
Hi,
I am trying to train a peg insertion task using stable-baselines3, and I am using SubprocVecEnv. However, after training for a while (about 90000 steps), I always encounter an EOFError with remote.recv().
Could you help me look into this bug? It would be of great help to me as I have been troubled by this issue for a long time.
Sincerely, George
To Reproduce
Relevant log output / Error message
Checklist