Loading a trained brain

All of the Unity samples come with pre-trained brains you can use to explore the samples. Of course, we want to be able to load our own TF graphs into Unity and run them. Follow the next steps in order to load a trained graph:

  1. Locate the ML-Agents/ml-agents/models/firstRun-0 folder. Inside this folder, you should see a file named GridWorldLearning.bytes. Drag this file into the Unity editor into the Project/Assets/ML-Agents/Examples/GridWorld/TFModels folder, as shown:
Dragging the bytes graph into Unity
  1. This will import the graph into the Unity project as a resource and rename it GridWorldLearning 1. It does this because the default model already has the same name.
  1. Locate the GridWorldLearning from the brains folder and select it in the Inspector windows and drag the new GridWorldLearning 1 model onto the Model slot under the Brain Parameters:

Loading the Graph Model slot in the brain
  1. We won't need to change any other parameters at this point, but pay special attention to how the brain is configured. The defaults will work for now.
  2. Press Play in the Unity editor and watch the agent run through the game successfully.
  3. How long you trained the agent for will really determine how well it plays the game. If you let it complete the training, the agent should be equal to the already trained Unity agent.

There are plenty of Unity samples that you can now run and explore on your own. Feel free to train several of the examples on your own or as listed in the exercises 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