Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training Suddenly Stops with Error 'numpy.int64' object has not attribute 'keys' #2

Open
TomasMendozaHN opened this issue Oct 20, 2018 · 1 comment

Comments

@TomasMendozaHN
Copy link

TomasMendozaHN commented Oct 20, 2018

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!

@dgiunchi
Copy link

dgiunchi commented Nov 1, 2018

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants