Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
17.19k stars 4.16k forks source link

Issues with getting brain info while using python API #645

Closed akmadian closed 6 years ago

akmadian commented 6 years ago

After about a week of experimenting, I couldn't find out how to get data contained in the BrainInfo class when using the python API and an external brain. I'm not sure if this was because I'm missing something in the docs or because this has not been implemented yet. To solve this, I added a method to BrainInfo that packages all attributes of BrainInfo as JSON and exports it to a .txt file.

env.step() is supposed to return all of the data, but nothing was being returned when it was called.

A couple things I still need to figure out:

My forked repository can be found here

The new brain.py file can be found here

The new environment file can be found here

I have not updated the docs in my forked repository for this change yet. Any suggestions in any form are very welcome.

eshvk commented 6 years ago

Hi @akmadian,

I am a bit confused here:

info = env.step()
brainInfo = info[<brain_name>] 

Isn't what you need all the members of the brainInfo object derived from the above step? Which you can then serialize however you wish?

akmadian commented 6 years ago

Thank you so much! I knew there must have been a better way. I'm not sure how I missed this. :/

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.