Because the case training method is different from ml-agent v0.2. v0.2 uses Jupyter notebook to run the ppo.ipynb file. But v0.3 uses the command line method instead.
Therefore, further update the blog post "ml-agent: Environment Installation under Win10", skip the installation (the installation process is not modified), and start from the fifth step. As follows.
5. Compile the Unity program
Use Unity2017 to open the unity-environment folder under ml-agent.
Open the 3DBall scene file in the Assets\ML-Agents\Examples\3DBall directory. Select the Ball3DBrain object under Ball3DAcademy in the scene, and change the TypeOfBrain to External, which means to obtain data from Tensorflow.
Select File->Build Setting in the menu to add the current scene. (You can check Development Build to see the output)
Click on PlayerSeting to check the settings
Resolution and Presentation -> 勾选Run in Background
Resolution and Presentation -> Display Resolution Dialog set to disable
Go back to the Build Setting panel, click Build, and compile it into the python directory of ml-agent. named 3dball.exe
6. Start training
Note that the training method is different from ml-agent v0.2. v0.2 uses Jupyter notebook to run the ppo.ipynb file. But v0.3 uses the command line method instead.
We go back to Anacoda Prompt and enter the following command:
python learn.py 3dball --run-id=test --train
in
- learn.py contains a large number of ml algorithms, including ppo.
- 3dball is the name of the exe file we just generated with unity.
- --run-id=test can not be written, just declare the id of this training. For example, you can use tensorboard to see
- --train indicates that the statement executes the training mode
If you are interested in these command parameters, please refer to Training ML-Agents
Since the training step is 5.0e4 (5*10 to the 4th power), if the CPU is relatively slow, you can temporarily modify the hyperparameter configuration file trainer_config.yaml, and add a line max_steps: 2.0e4 under Ball3DBrain (note that due to this file Using yaml format, the encoding format and space requirements of the file are very strict. If it is abnormal, it will not be able to train. There are 4 spaces in front of max, not tab. There is a space after the colon, and the entire file is encoded in UTF8).
The training result data is saved under models\test\. For using the bytes file, please refer to ML-Agent: Using the trained model data through TF#
The above updates are from CodeGize's personal blog (Daniel). There is a link to the original text of Daniel in the blog post "ml-agent: Environment Installation under Win10".