Time for training

However we decide to use this platform, whether for training or testing, we now need to do the last brain configuration step, in order to set any custom hyperparameters that we may decide to use for training. Open a Python/Anaconda console and prepare it for training, and then follow these steps:

  1. Open the trainer_config.yaml file located in the ML-Agents/ml-agents/config folder.
  2. We will add a new configuration section to the config file, modeled after one of the other visual environments. Add the new configuration, as follows:
TestingLearningBrain:
use_recurrent: true
sequence_length: 64
num_layers: 1
hidden_units: 128
memory_size: 256
beta: 1.0e-2
gamma: 0.99
num_epoch: 3
buffer_size: 1024
batch_size: 64
max_steps: 5.0e5
summary_freq: 1000
time_horizon: 64
  1. Notice that we added the word brain, in order to differentiate it from the other brains. This brain is modeled after the VisualHallwayBrain that we spent some time exploring previously. Keep in mind, however, that we are running a continuous action problem now, and this can affect some parameters.
  2. Save the file and return to the Unity editor.
  3. Locate the TestingAcademy object, swap its Brains for a TestingLearningBrain, and set it to Control, as you have done so many times before.
  1. Save the scene and project and return to the Python/Anaconda console.
  2. Start a training/learning/testing session by running the following command:
mlagents-learn config/trainer_config.yaml --run-id=testing --train
  1. Watch the training session and the agent play the game. The agent will run, and depending on how long you train, it may become good at finding the goals.

At this point, you can let the agent go and just run through your level on its own, exploring. However, what we want to do is control or nudge the testing agent to the right path by using imitation learning, which we will discuss 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