Ml-agents: How do I train on a mobile device?

Created on 2 Jun 2019  路  14Comments  路  Source: Unity-Technologies/ml-agents

Hi. I am a developer who is enjoying ml-agent nowadays.
I am trying to follow the documentation here.
(https://github.com/Unity-Technologies/ml-agents)

I am currently using Windows 10.
So I use mlagents-learn config / config.yaml --run-id = -train command in Anaconda Prompt.
After the mobile build, I wonder how to start training.
Even if I search, I can not find a proper answer and try to write.
I saw an article that uses AWS as shown below. I would like to know if this is common.
(https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-on-Amazon-Web-Service.md)

request

Most helpful comment

Sure. For example, a robot battle arena:

Each user places an AI battle bot with its own brain in an arena. They customize a combination of weapons/sensors/motors on the bot.

Behind the scenes, on a server, a battle is simulated 1000s of times and a neural network is created and sent back to the user.

The user enters a battle with other players.
The AI will use its custom NN to path and make decisions about the battle using their unique set of components.

All 14 comments

hi @smilejsu82 - are you creating a separate build from the Unity scene? if so, you need to specific the env-name parameter for the mlagents-learn call as well.

Thank you for answer.
I have checked the following manuals.

" (Optional) is the name (including path) of your Unity executable containing the agents to be trained."

At this time, I do not know how to set the path for the Android platform.

hi @smilejsu82 - you should be setting the target build to windows to do the training. once the training is complete, you can put the .nn file back and then build / deploy to android.

Thank you for answer.
As you mentioned, after Windows build, reinforcement learning was possible with the following command.

(ml-agents) D:workspaceunityTestUnitySDK>mlagents-learn trainer_config.yaml --env=C:UserssmilejsuDesktoptest-mlagent.exe --run-id=test0 --train

You can also load the generated .nn file and apply it to the agent.
But it's still a question.
I have not figured out how to train on the mobile platform (android / iOS) yet.

https://smilejsu.tistory.com/1697

Is this possible?

hi @smilejsu82 - unfortunately we do not enable training on the mobile platform. Can you describe why you are trying to train on a mobile device?

I am developing games using ml-agent.
This game allows the user to train a given character.
Every user can train a given character in several ways (reinforcement learning)
For example, avoiding the arrows that come in, drinking a potion if you lack physical strength, attacking nearby enemies, etc.
We want to create a game that can compete with trained characters on the battlefield.
So I want to learn mobile devices.

Hello,

I am following this thread because my goal is very similar. I wanted to have many different brains all trained to do the same task, but users could end up with different results based on how they train their characters.

My plan right now is to just have the users send their training settings to a server (via interface in a mobile app) and the server actually does the training.

To the user it will seem as though they are training the character on their mobile device.

Hello,

I am following this thread because my goal is very similar. I wanted to have many different brains all trained to do the same task, but users could end up with different results based on how they train their characters.

My plan right now is to just have the users send their training settings to a server (via interface in a mobile app) and the server actually does the training.

To the user it will seem as though they are training the character on their mobile device.

To confirm my understanding - the user of your game is able to select or configure how they want the agent to be trained. Once they select or configure, the game would train the agent in the way the user wants? Could you elaborate more on this?

Sure. For example, a robot battle arena:

Each user places an AI battle bot with its own brain in an arena. They customize a combination of weapons/sensors/motors on the bot.

Behind the scenes, on a server, a battle is simulated 1000s of times and a neural network is created and sent back to the user.

The user enters a battle with other players.
The AI will use its custom NN to path and make decisions about the battle using their unique set of components.

i see, thank you for the feedback @rsfutch77. Due to the training times, that example might be very difficult to pull off. What you might try to do is train N number of brains based on the possible combinations of weapons, sensors, and motors. Then, when a user selects the combination, during runtime, the game could load the pre-trained brain.

The goal would be for an infinite number of combinations. Imagine having an amount of points to spread across each battle bot trait/variable. In this simple game, the training time might be similar to some of the examples in the repo. Players would be able to play with old brains while they wait ~15 minutes to train a new brain.

Allow me to provide another example. In this case the user controls the battle bot directly against an AI. I want the AI to learn from the player's behavior and implement a new brain to fight the player as it learns. With thousands of players, the AI would learn very quickly (after starting with some baseline brain). Basically crowd sourced inference training.

The same situation applies where the training is done on a server and the mobile user just receives brain updates as they are finished.

thanks for additional details @rsfutch77. we've collected the feedback. as we ship more real-time training / on-device training scenarios, we'll reach back out to get additional feedback.

Thank you for submitting this request. We鈥檝e added it to our internal tracker with the ID MLA-75. I鈥檓 going to close this issue for now, but we鈥檒l ping back with any updates

Any news on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gerardsimons picture gerardsimons  路  3Comments

DVonk picture DVonk  路  3Comments

Sohojoe picture Sohojoe  路  3Comments

MarcPilgaard picture MarcPilgaard  路  3Comments

scotthovestadt picture scotthovestadt  路  4Comments