DQN-using-PyTorch-and-ML-Agents
DQN-using-PyTorch-and-ML-Agents copied to clipboard
Training Suddenly Stops with Error 'numpy.int64' object has not attribute 'keys'
Once i start training, Unity window pops up and i can see the agent moving around at fast speed so everything looks ok. However, after a few seconds this error message shows up:
INFO:unityagents: 'Academy' started successfully! Unity Academy name: Academy Number of Brains: 1 Number of External Brains : 1 Lesson number : 0 Reset Parameters :
Unity brain name: BananaBrain
Number of Visual Observations (per agent): 0
Vector Observation space type: continuous
Vector Observation space size (per agent): 37
Number of stacked Vector Observation: 1
Vector Action space type: discrete
Vector Action space size (per agent): 4
Vector Action descriptions: , , ,
Episode 1 Average Score: 0.00Traceback (most recent call last):
File "train.py", line 177, in
Can you please let me know how to fix it? Thanks!
To fix this, your action has to be an np.int32. When a random action is selected argmax generate an int64. The solution is to cast it to int so x.astype(int).