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

Imitation learning outside the editor? Imitation + curriculum learning?

Open BartMartner opened this issue 8 years ago • 7 comments

So imitation learning seems really powerful! I'm trying to use it to train deathmatch bots in a 2d platformer and the results seems fairly promising. However, I don't know that I'll ever be able to teach them a general way to solve a wide variety of platforming problem by having it watch a single session of play in a single environment. I'm feeding the brain a representation of the tilemap, some raycast, and some info on the position and direction of goals as training data, but it seems to get stuck where it would need to make two jumps (to one platform then another) to reach said goals.

The way I understand imitation learning is that the teacher/player brain is recording input/output pairs and then those are being back propagated into the student brain. Is there currently any way to save those recordings from the player brain across multiple sessions and then back prop a whole bunch of them while the editor isn't running? I think it would be useful if I could record multiple play sessions in different environments, each focused on different simple tasks, then have a brain just repeatedly learn on that for a good long bit while I go watch TV and eat a sandwich.

Is this possible? How do?

BartMartner avatar Aug 04 '18 18:08 BartMartner

hi @BartMartner thank you for your comment. unfortunately, this isn't yet available today, but we are considering adding some functionality. if you are also interested to help contribute to this type of feature, we would welcome that as well.

shihzy avatar Aug 06 '18 15:08 shihzy

Thanks for the reply! I'd love to contribute, but think it might be out of my depth.

I've poked around trying to figure it out, but don't feel confident in my understanding of the existing code.

I assume that the AgentInfoProto that Batcher.cs is appending to the message it sends to Python (line 258 in Batcher.cs) is what would need to be serialized and saved to some file(s). I think that maybe contains that input/output data?

I'm not sure what's involved in serializing a sealed partial class, and I know virtually nothing about Python. So even past that step I'm not certain how to pass the data in those saved files to learn.py (or whatever it's communicating to) and spit out bytes.

BartMartner avatar Aug 06 '18 16:08 BartMartner

no worries @BartMartner - we'll add this issue as part of our exploration to enable scenarios for using imitation learning to learn from non-human players

shihzy avatar Aug 06 '18 21:08 shihzy

Has any headway been made with imitation learning via recorded data and/or outside the editor?

BartMartner avatar Nov 20 '18 02:11 BartMartner

+1 for this!!

vqt123 avatar Jan 16 '19 14:01 vqt123

Hi all - closing this as we have shipped demonstration recorder in v0.6 https://blogs.unity3d.com/2018/12/17/ml-agents-toolkit-v0-6-improved-usability-of-brains-and-imitation-learning/?_ga=2.158778168.364000799.1554222568-145274537.1510700117

shihzy avatar Apr 03 '19 22:04 shihzy

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 02:01 github-actions[bot]