You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
I used VSCode to debug the PPO2 algorithm in the project OpenAI baselines. Lines 57-58 of the file baselines/common/vec_env/subproc_vec_env.py uses the pipeline to receive data. When debugging to line 58:
I think this might be due to multiprocessing using fork. That should be addressed by this issue #943.
You could try set multiprocessing.set_start_method('spawn') before using it.
@karthiknadig
This method does work. Great! You're awesome. Thank you very much. Here is my modifications in the file baselines/common/vec_env/subproc_vec_env.py:
Modification 1: Line 1-3
import numpy as np
from multiprocessing import Process, Pipe
from . import VecEnv, CloudpickleWrapper
to
import numpy as np
import multiprocessing
from multiprocessing import Process, Pipe
from . import VecEnv, CloudpickleWrapper
Modification 2: Line 48-50
self.remotes, self.work_remotes = zip(*[Pipe() for _ in range(nenvs)])
self.ps = [Process(target=worker, args=(work_remote, remote, CloudpickleWrapper(env_fn)))
for (work_remote, remote, env_fn) in zip(self.work_remotes, self.remotes, env_fns)]
to
self.remotes, self.work_remotes = zip(*[Pipe() for _ in range(nenvs)])
# Set the multi-process startup method to 'spawn` instead of `fork` to support VSCode debugging.
multiprocessing.set_start_method('spawn')
self.ps = [Process(target=worker, args=(work_remote, remote, CloudpickleWrapper(env_fn)))
for (work_remote, remote, env_fn) in zip(self.work_remotes, self.remotes, env_fns)]
I used VSCode to debug the PPO2 algorithm in the project OpenAI baselines. Lines 57-58 of the file
baselines/common/vec_env/subproc_vec_env.py
uses the pipeline to receive data. When debugging to line 58:the program has no response and the debugging process cannot continue (As shown below).
My configuration file
.vscode/launch.json
is shown as follows:When I used the command line
python -m baselines.run --alg=ppo2 --env=PongNoFrameskip-v4 --num_timesteps=2e7 --save_path=~/models/pong_20M_ppo2
to run the program in a terminal, there is no problem.
Any helpful suggestions will be highly appreciated. Thank you.
The text was updated successfully, but these errors were encountered: