Training Suddenly Stops with Error 'numpy.int64' object has not attribute 'keys'
TomasMendozaHN opened this issue · 1 comments
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
env_info = env.step(action)[brain_name]
File "C:\Users\Tomas\AppData\Local\conda\conda\envs\Unity\lib\site-packages\unityagents\environment.py", line 322, in step
for brain_name in list(vector_action.keys()) + list(memory.keys()) + list(text_action.keys()):
AttributeError: 'numpy.int64' object has no attribute 'keys'
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).