Kaixhin / Rainbow

Rainbow: Combining Improvements in Deep Reinforcement Learning
MIT License
1.59k stars 284 forks source link

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' #18

Closed forhonourlx closed 6 years ago

forhonourlx commented 6 years ago

...... self.actions.get(action): 4 self.actions.get(action): 4 self.actions.get(action): 4 self.actions.get(action): 4 self.actions.get(action): 1 self.actions.get(action): 1 self.actions.get(action): 1 self.actions.get(action): 1 self.actions.get(action): None

Traceback (most recent call last): File "main.py", line 103, in next_state, reward, done = env.step(action) # Step File "C:\Users\simon\Desktop\DQN\RL-AlphaGO\Rainbow-master\env.py", line 63, in step reward += self.ale.act(self.actions.get(action)) File "C:\Program Files\Python35\lib\site-packages\atari_py\ale_python_interface.py", line 159, in act return ale_lib.act(self.obj, int(action)) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Kaixhin commented 6 years ago

I see you're printing self.actions.get(action) and it's returning None. Can you also print action as well (just beforehand). Also print self.actions once (can do that at the end of the __init__ function in Env)? Which game are you using (default is Space Invaders)?

forhonourlx commented 6 years ago

Yes, the default is 'space_invaders'.

at init self.actions: {0: 0, 1: 1, 2: 3, 3: 4, 4: 11, 5: 12} ... action: 5 ,self.actions.get(action): 12 ,done: False action: 5 ,self.actions.get(action): 12 ,done: False action: 5 ,self.actions.get(action): 12 ,done: False action: 5 ,self.actions.get(action): 12 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 3 ,self.actions.get(action): 4 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 1 ,self.actions.get(action): 1 ,done: False action: 2 [torch.cuda.LongTensor of size () (GPU 0)] ,self.actions.get(action): None ,done: False

Kaixhin commented 6 years ago

This seems like another change introduced by PyTorch 0.4. There's a lot of breaking changes so for now I would suggest downgrading to 0.3.1 if possible. Once 0.4 is released (I believe very soon) then I'll start working on porting the code.

forhonourlx commented 6 years ago

Hi Kaixhin, thank you all the way. Sorry about my unfimilarity with PyTorch. It's hard to find some keras implemenation of Rainbow DQN, and does it represent the heat of frameworks in some extent? What's the advantages of PyTorch in your opinion?

Kaixhin commented 6 years ago

PyTorch is very Pythonic - you can write programs normally and introduce deep learning components. This means its much easier to deal with interacting with an environment, storing data in data structures etc. Becoming familiar with programming in Python in general, as well as going through the PyTorch tutorials, can help you become more familiar with it.