Configuring the agent to use IL

We have already run through the process of setting up and running an offline imitation learning (IL) session, but let's review the process in the next exercise:

  1. Open the Unity editor to the same project and locate the Vehicle2 object containing the agent.
  2. Switch the agent's brain from TestingPlayerBrain to TestingLearningBrain.
  3. Select the TestingAcademy and enable the Control property on the Testing Academy | Brains component property.
  4. Save the scene and project.
  5. Open the config/offline_bc_config.yaml file in a text or code editor.
  6. Add the following section (a modified copy of HallwayLearning):
TestingLearningBrain:
trainer: offline_bc
max_steps: 5.0e5
num_epoch: 5
batch_size: 64
batches_per_epoch: 5
num_layers: 2
hidden_units: 128
sequence_length: 16
use_recurrent: true
memory_size: 256
sequence_length: 32
demo_path: ./UnitySDK/Assets/Demonstrations/Testing.demo
  1. Save the file when you are done editing it.
  2. Open a Python/Anaconda console that is ready for training, and enter the following command:
mlagents-learn config/offline_bc_config.yaml --run-id=testing_il --train
  1. Note a couple of modifications, highlighted in bold. After the training starts, watch the agent drive the car in the same manner that you trained it (or at least, it will try to).
  2. Let the agent play the game, and watch how well it performs and/or gets into trouble. 

This demo/game is quite stable and is not prone to any obvious issues, which makes testing it for obvious issues difficult. However, hopefully, you can appreciate that if this type of system is implemented very early in a game, even just for testing, it provides the ability to quickly find bugs and other issues. Of course, currently, our only method to identify any issues is to watch the agent play, which doesn't save us any time. What we need is a way to track agent activity and determine whether (and when) the agent finds itself in trouble. Fortunately, we can easily add this form of tracking by adding analytics, which we will cover in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset