Installing ML-Agents

In this section, we cover a high-level overview of the steps you will need to take in order to successfully install the ML-Agents SDK. This material is still in beta and has already changed significantly from version to version. As such, if you get stuck going through these high-level steps, just go back to the most recent Unity docs; they are very well written.

Jump on your computer and follow these steps; there may be many sub steps, so expect this to take a while:

  1. Be sure you have Git installed on your computer; it works from the command line. Git is a very popular source code management system, and there is a ton of resources on how to install and use Git for your platform. After you have installed Git, just be sure it works by test cloning a repository, any repository.
  2. Open a command window or a regular shell. Windows users can open an Anaconda window.
  3. Change to a working folder where you want to place the new code, and enter the following command (Windows users may want to use C:ML-Agents):
git clone https://github.com/Unity-Technologies/ml-agents
  1. This will clone the ml-agents repository onto your computer and create a new folder with the same name. You may want to take the extra step of also adding the version to the folder name. Unity, and pretty much the whole AI space, is in continuous transition, at least at the moment. This means new and constant changes are always happening. At the time of writing, we will clone to a folder named ml-agents.6, like so:
git clone https://github.com/Unity-Technologies/ml-agents ml-agents.6
The author of this book previously wrote a book on ML-Agents and had to rewrite several chapters over the course of a short time in order to accommodate the major changes. In fact, this chapter has had to be also rewritten a few times to account for more major changes.
  1. Create a new virtual environment for ml-agents and set it to 3.6, like so:
#Windows 
conda create -n ml-agents python=3.6

#Mac
Use the documentation for your preferred environment
  1. Activate the environment, again, using Anaconda:
activate ml-agents
  1. Install TensorFlow. With Anaconda, we can do this by using the following:
pip install tensorflow==1.7.1

  1. Install the Python packages. On Anaconda, enter the following:
cd ML-Agents #from root folder
cd ml-agents or cd ml-agents.6 #for example
cd ml-agents
pip install -e . or pip3 install -e .
  1. This will install all the required packages for the Agents SDK and may take several minutes. Be sure to leave this window open, as we will use it shortly.
This is the basic installation of TensorFlow and does not use a GPU. Consult the Unity documentation in order to learn how to install the GPU version. This may or may not have a dramatic impact on your training performance, depending on the power of your GPU.

This should complete the setup of the Unity Python SDK for ML-Agents. In the next section, we will learn how to set up and train one of the many example environments provided by Unity.

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

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