PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning
MIT License
6.99k stars 644 forks source link

error randomly happens while training #160

Open dewmguy opened 10 months ago

dewmguy commented 10 months ago
step:  20050 event:  4.00 level: 44.00 heal:  4.31 op_lvl:  0.00 dead: -0.40 badge:  0.00 explore: 59.52 sum: 111.43Process SpawnProcess-10:
Traceback (most recent call last):
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\vec_env\subproc_vec_env.py", line 35, in _worker
    observation, reward, terminated, truncated, info = env.step(data)
  File "C:\Users\jerem\OneDrive\Projects\python\PokemonRedExperiments\baselines\red_gym_env.py", line 225, in step
    self.save_and_print_info(step_limit_reached, obs_memory)
  File "C:\Users\jerem\OneDrive\Projects\python\PokemonRedExperiments\baselines\red_gym_env.py", line 402, in save_and_print_info
    plt.imsave(
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\matplotlib\pyplot.py", line 2200, in imsave
    return matplotlib.image.imsave(fname, arr, **kwargs)
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\matplotlib\image.py", line 1689, in imsave
    image.save(fname, **pil_kwargs)
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\PIL\Image.py", line 2429, in save
    fp = builtins.open(filename, "w+b")
PermissionError: [Errno 13] Permission denied: 'session_b890c2bc\\curframe_4b3a833e.jpeg'
Traceback (most recent call last):
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\multiprocessing\connection.py", line 312, in _recv_bytes
    nread, err = ov.GetOverlappedResult(True)
BrokenPipeError: [WinError 109] The pipe has been ended

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\jerem\OneDrive\Projects\python\PokemonRedExperiments\baselines\run_baseline_parallel_fast.py", line 83, in <module>
    model.learn(total_timesteps=(ep_length)*num_cpu*1000, callback=CallbackList(callbacks))
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\ppo\ppo.py", line 308, in learn
    return super().learn(
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\on_policy_algorithm.py", line 259, in learn
    continue_training = self.collect_rollouts(self.env, callback, self.rollout_buffer, n_rollout_steps=self.n_steps)
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\on_policy_algorithm.py", line 178, in collect_rollouts
    new_obs, rewards, dones, infos = env.step(clipped_actions)
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\vec_env\base_vec_env.py", line 197, in step
    return self.step_wait()
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\vec_env\vec_transpose.py", line 95, in step_wait
    observations, rewards, dones, infos = self.venv.step_wait()
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\vec_env\subproc_vec_env.py", line 130, in step_wait
    results = [remote.recv() for remote in self.remotes]
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\site-packages\stable_baselines3\common\vec_env\subproc_vec_env.py", line 130, in <listcomp>
    results = [remote.recv() for remote in self.remotes]
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\multiprocessing\connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "C:\Users\jerem\.conda\envs\PokemonRedExperiments\lib\multiprocessing\connection.py", line 321, in _recv_bytes
    raise EOFError
EOFError

(PokemonRedExperiments) C:\Users\jerem\OneDrive\Projects\python\PokemonRedExperiments\baselines>
w531t4 commented 10 months ago

@dewmguy What you've pasted indicates the code had an issue writing out one of the jpeg files. It would be best if you could include information about the system you've executed the code on, steps to recreate the issue on-demand, etc.

dewmguy commented 10 months ago

pretty minimal. running in conda env in windows.