PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index out of bounds error

Lawbayly opened this issue · comments

Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/lawrence/PokemonRedExperiments/baselines/python3/lib/python3.11/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 35, in _worker
    observation, reward, terminated, truncated, info = env.step(data)
                                                       ^^^^^^^^^^^^^^
  File "/home/lawrence/PokemonRedExperiments/baselines/red_gym_env.py", line 197, in step
    obs_memory = self.render()
                 ^^^^^^^^^^^^^
  File "/home/lawrence/PokemonRedExperiments/baselines/red_gym_env.py", line 182, in render
    self.create_exploration_memory(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lawrence/PokemonRedExperiments/baselines/red_gym_env.py", line 359, in create_exploration_memory
    make_reward_channel(explore)
  File "/home/lawrence/PokemonRedExperiments/baselines/red_gym_env.py", line 349, in make_reward_channel
    memory[:col, row] = 255
    ~~~~~~^^^^^^^^^^^
IndexError: index 40 is out of bounds for axis 1 with size 40

I think something must be overflowing one of the variables, although I'm unsure how to resolve it. I have come across this before even with the original run_pretrained_interactive, after a while one of the values overflows and causes this error.

Is it only happening with the pretrained runs? If so, make sure you have the latest version of the repo pulled, PWhiddy updated it yesterday to fix pretrained games ending after 32k steps. I never ran into that error so I don't know if your error output is related to that problem or not, that's just my first guess.

It is happening with baseline_parallel_fast also, but I did originally encounter it with a pretrained run though.

I'm pulled the latest version now to see if it works better. I also updated pyboy as that was mentioned as a recent change

But nope.. it is still occurring... note it's a fairly long session I'm continuing though, by adding the checkpoint in the run_baseline_parallel_fast

This one I that is in this report is with run_baseline_parallel_fast not run_pretrained_interactive so maybe those fixes need to be ported across?

The issue happens when too much exploration happens and it overflows the exploration progress bar. I think I can add a quick fix