'UnityEnvironment' object has no attribute 'behavior_spec'

╄→尐↘猪︶ㄣ 提交于 2020-06-28 03:42:20

问题


I followed this link to doc to create environment of my own.

But when i run this

from mlagents_envs.environment import UnityEnvironment
env = UnityEnvironment(file_name="v1-ball-cube-game.x86_64")


env.reset()
behavior_names = env.behavior_spec.keys()
print(behavior_names)

Game window pop up and then terminal show error saying

Traceback (most recent call last):
  File "index.py", line 6, in <module>
    behavior_names = env.behavior_spec.keys()
AttributeError: 'UnityEnvironment' object has no attribute 'behavior_spec'

despite the fact that this is the exact snippet as shown in the documentation.

I created environment by following this (it make without brain) and i was able to train the model by .conf file. Now i wanted to connect to python API.


回答1:


You need to use stable documents and stable repo( RELEASE_TAGS ) to achieve stable results. Unity ML Agents changes it's syntax every few months so that is problem if you are following master branch.

env.get_behavior_spec(behavior_name: str)

Should solve your problem.

https://github.com/Unity-Technologies/ml-agents/blob/release_2/docs/Python-API.md



来源:https://stackoverflow.com/questions/62194104/unityenvironment-object-has-no-attribute-behavior-spec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!