devsisters / DQN-tensorflow

Tensorflow implementation of Human-Level Control through Deep Reinforcement Learning
MIT License
2.46k stars 765 forks source link

Error! TimeLimit' object has no attribute 'ale' #29

Open tangyudi opened 7 years ago

tangyudi commented 7 years ago

I run this code in cpu and this error occurred.

TimeLimit' object has no attribute 'ale' Can anyone show me how to solve this matter? Thank you !

Lan1991Xu commented 7 years ago

Hi, you can just pip install gym==0.7.0 solve this problem. This is because new gym 0.8.0 released and it is hard to use for this code.

tangyudi commented 7 years ago

@Lan1991Xu Thanky you! Can I test with this check point? When I use python main.py --is_train=False --display=True,it occur a load failed error.

DanielTakeshi commented 7 years ago

I'm also running into this problem. How would we use this for the latest version of gym?

cteckwee commented 7 years ago

Try to unwrap the env env = env.unwrapped

scratch314 commented 7 years ago

Only Breakout can be applied. Try the following code.

def init(self, config): self.step_info = None

def _step(self, action): self._screen, self.reward, self.terminal, self.step_info = self.env.step(action)

def lives(self): if self.step_info is None: return 0 else: return self.step_info['ale.lives']

fanyuzeng commented 6 years ago

How to solve this problem? I try pip install gym==0.7.0, but it failed. In addition, I try the following code in main.py , it also failed.

def init(self, config): self.step_info = None

def _step(self, action): self._screen, self.reward, self.terminal, self.step_info = self.env.step(action)

def lives(self): if self.step_info is None: return 0 else: return self.step_info['ale.lives']

mumbho commented 6 years ago

I have the same issue; tried to revert gym to 0.7.4 and 0.7.3 (from repo) but then atari games will render as text. I've tried with other gym versions as well. I can only render atari envs using the latest version, but then dqn breaks. Any solution is greatly appreciated. When using latest gym version, tried to unwrap env as suggested, got into another issue: in /home/me/work/bitbucket/NeuralNetworks/My/dependencies/gym/gym/wrappers/time_limit.py error: Cannot call env.step() before calling reset()