openai / coinrun

Code for the paper "Quantifying Transfer in Reinforcement Learning"
https://blog.openai.com/quantifying-generalization-in-reinforcement-learning/
MIT License
388 stars 87 forks source link

fix bug in the random agent example script #9

Closed act65 closed 5 years ago

act65 commented 5 years ago

When I ran the original script I got

Logging to /tmp/openai-2018-12-14-17-36-08-425220
make: Entering directory '/home/act65/repos/coinrun/coinrun'
make: Nothing to be done for 'all'.
make: Leaving directory '/home/act65/repos/coinrun/coinrun'
Traceback (most recent call last):
  File "main.py", line 6, in <module>
    env = make('standard', num_envs=16)
  File "/home/act65/repos/coinrun/coinrun/coinrunenv.py", line 216, in make
    return CoinRunVecEnv(env_id, num_envs, **kwargs)
  File "/home/act65/repos/coinrun/coinrun/coinrunenv.py", line 156, in __init__
    obs_space = gym.spaces.Box(0, 255, shape=[self.RES_H, self.RES_W, num_channels], dtype=np.uint8)
AttributeError: module 'gym' has no attribute 'spaces'

Adding import gym.spaces fixes the bug (see issue here). Although maybe it should be imported elsewhere!?

christopherhesse commented 5 years ago

The random agent example script doesn't seem to reference gym.spaces at all, I think you meant to put that fix into coinrunenv.py which is where the error is in your stack trace.

act65 commented 5 years ago

yea, that makes more sense (still not super familiar with git/contributing). this should be ok?

christopherhesse commented 5 years ago

Yeah looks good, thanks for the PR!