ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Offline Imitation Learning advice

Open Nevak opened this issue 7 years ago • 6 comments

Hello everyone!

We're currently developing a PvP monster battle game. It's similar to Pokemon in the sense that each player has a team of creatures to battle against an opponent. However the combats are in real time and you're limited by the energy/stamina cost of each skill and the recovery rate of this energy.

Technically we have a Unity dedicated server that can host multiple isolated battles and currently is recording all of them (using the provided DemonstrationRecorder) for the purpose of training an AI.

The goal is to use players battles to continuously train the AI, retraining the model periodically with new demonstrations.

Any suggestions on how to achieve this? Or are there new features ahead in the roadmap to improve the workflow of offline imitation learning?

Additionally there are a couple of doubts in my mind:

  • For each battle and player we have a demonstration file. However would it be possible to concatenate or merge all these demo files to feed them to the BC offline algorithm?

  • Another doubt that we are currently having is, why does unity need to be running when generating a policy using offline BC? As we understand this process could be done completely inside the python API and Tensorflow, couldn't it?

Thanks a lot beforehand

Nevak avatar Jan 18 '19 16:01 Nevak

Hi @Nevak thanks for your comment! Have you filled our survey? We would love to hear more about this game you are working on.

Regarding your question:

  1. The demo files are basically protobuf file, you can write something that reads all of these files and merge them together easily. In the near future we will have this functionality, but it is not in our codebase yet.

  2. Yes it could be. However the current version of the offline bc uses part of the online bc code, that's why it is still connect to the Unity editor. To separate these things out will require some additional work.

xiaomaogy avatar Jan 19 '19 00:01 xiaomaogy

Thanks for the quick and super celar reply @xiaomaogy !

Finally managed to merge some recording files (by making sure their brain parameters match first, then extracting all the AgentInfos recorded in each file and passing them to a new DemonstrationStroe which nicely does the rest of the job of keeping track of and writing the metadata.

Thanks also for pointing out the survey, for sure we'll fill it right away :)

Nevak avatar Jan 20 '19 12:01 Nevak

Could you save me? I'm a novice. I'm working on a game. The basic idea is to collect data from users and then train AI with data. My idea is to collect data by providing DemonstrationRecorder, then upload it to the server, and finally feed them to the BC offline algorithm. Is this method feasible? Could you give me some advice?

guoguoguilai avatar Feb 07 '19 06:02 guoguoguilai

You may want to check my comment to your question in: https://github.com/Unity-Technologies/ml-agents/issues/1399#issuecomment-461601895

hyounesy avatar Feb 07 '19 21:02 hyounesy

As of v0.9, you can give a directory to the YAML file to read in multiple demo files.

Closing this issue for now - thanks!

ervteng avatar Oct 01 '19 23:10 ervteng

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.

github-actions[bot] avatar Jan 29 '21 06:01 github-actions[bot]