浏览代码

Separated GPU based training as optional and adv.

/develop-generalizationTraining-TrainerController
GitHub 7 年前
当前提交
036cead5
共有 1 个文件被更改,包括 89 次插入87 次删除
  1. 176
      docs/Installation-Windows.md

176
docs/Installation-Windows.md


In order to get ML-Agents working with Windows, you will need to have Windows 10 installed. While it is possible for ML-Agents to work on other versions of Windows, we have only tested with a local installation of Windows 10 (not using a VM like Bootcamp or Parallels).
Additionally, you will need to check if your GPU is CUDA compatible. Please check Nvidia's page [here](https://developer.nvidia.com/cuda-gpus).
To get ML-Agents to run, you will need install Python and the required Python packages to run ML-Agents. We have also included a guide that includes GPU based training (for advanced users). This is not required for v0.3 of ML-Agents. However, for future versions and features, it may be required.
## Step 1: Install Python via Anaconda
<a href="https://www.anaconda.com/download/#windows" target="_blank">Download</a> and install Anaconda for Windows. By using Anaconda, you can use manage separate environments for different distributions of Python. We **strongly** recommend using Python 3 as we do not guarantee supporting Python 2 in future releases. In this guide, we are using Python version 3.6 and Anaconda version 5.1 ([64-bit](https://repo.continuum.io/archive/Anaconda3-5.1.0-Windows-x86_64.exe) or [32-bit](https://repo.continuum.io/archive/Anaconda3-5.1.0-Windows-x86.exe) direct links).
## Step 1: Install Nvidia CUDA toolkit
<p align="center">
<img src="images/anaconda_install.PNG"
alt="Anaconda Install"
width="500" border="10" />
</p>
We recommend the default _advanced installation options_. However, select what would work for your specific situation.
<p align="center">
<img src="images/anaconda_default.PNG"
alt="Anaconda Install"
width="500" border="10" />
</p>
After installation, you will need to open __Anaconda Navigator__ to finish. From the Windows search bar, type _anaconda navigator_. You can close Anaconda Navigator after it opens.
## Step 2: Setup and Activate a New Conda Environment
You will create a new Conda environment to be used with ML-Agents. This means that all the packages that you install are localized to just this environment. It will not affect any other installation of Python or other environments. Whenever you want to run ML-Agents, you will need activate this Conda environment.
To create a new Conda environment, open a new Anaconda Prompt (_Anaconda Prompt_ in the search bar) and type in the following command:
conda create -n ml-agents python=3.6
You may be asked to install new packages. Type `y` and press enter _(make sure you are connected to the internet)_. You will need to install these packages. This command will create a new Conda environment called ml-agents using Python version 3.6.
<p align="center">
<img src="images/conda_new.PNG"
alt="Anaconda Install"
width="500" border="10" />
</p>
To use this environment, you will need to activate it. _(In the future, if you need to use this environment again, you can run the same command)_. In the same Anaconda Prompt, type in the following command:
conda activate ml-agents
You should see `(ml-agents)` prepended on the last line.
After this, you will need to install `tensorflow` and `tensorflow-gpu`. This can be installed by using `pip` - which is a package management system used to install Python packages. In the same Anaconda Prompt, type in the following command _(make sure you are connected to the internet)_:
pip install tensorflow tensorflow-gpu
Lastly, you should test to see if everything installed properly. You can do this to see if TensorFlow can identify your GPU. In the same Anaconda Prompt, type in the following command:
python
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
You should see something similar to:
```
Found device 0 with properties ...
```
## Step 3: Install Required Python Packages
ML-Agents includes a list of Python dependencies needed to run. Similarly in Step 4, you will be using `pip` to install these Python packages.
If you haven't already, make sure to clone the repository. You can do this using Git ([download here](https://git-scm.com/download/win)) and running the following commands in a new or same Anaconda Prompt (_if you closed the prompt from Step 5, you can activate the ml-agents Conda environment by typing `activate ml-agents`_):
git clone git@github.com:Unity-Technologies/ml-agents.git
If you don't want to use Git, you can always directly download all the files [here](https://github.com/Unity-Technologies/ml-agents/archive/master.zip).
In our example, the files are located in `C:\Downloads`. After you have either cloned or downloaded the files, from the Anaconda Prompt, change to the python directory inside the ML-agents directory:
cd C:\Downloads\ml-agents\python
Make sure you are connected to the internet and then type in the Anaconda Prompt:
pip install .
This will complete the installation of all the required Python packages to run ML-Agents.
## (Optional) GPU Training using ML-Agents
Not required to use v0.3 for ML-Agents. This is a guide for advanced users who want to train using GPUs. Additionally, you will need to check if your GPU is CUDA compatible. Please check Nvidia's page [here](https://developer.nvidia.com/cuda-gpus).
## (Optional) Step 1: Install Nvidia CUDA toolkit
<a href="https://developer.nvidia.com/cuda-toolkit-archive" target="_blank">Download</a> and install the CUDA toolkit from Nvidia's archive. The toolkit includes GPU-accelerated libraries, debugging and optimization tools, a C/C++ compiler and a runtime library and is needed to run ML-Agents. You can select the latest or previous releases. In this guide, we are using version 9.1.85.3 ([direct link](https://developer.nvidia.com/compute/cuda/9.1/Prod/patches/3/cuda_9.1.85.3_windows)).

width="500" border="10" />
</p>
## Step 2: Install Nvidia cuDNN library
## (Optional) Step 2: Install Nvidia cuDNN library
<a href="https://developer.nvidia.com/cudnn" target="_blank">Download</a> and install the cuDNN library from Nvidia. cuDNN is is a GPU-accelerated library of primitives for deep neural networks. Before you can download, you will need to sign up for free to the Nvidia Developer Program.

width="500" border="10" />
</p>
## Step 3: Set Environment Variables
## (Optional) Step 3: Set Environment Variables
You will need to add one environment variable and two path variables.

width="500" border="10" />
</p>
## Step 4: Install Python via Anaconda
<a href="https://www.anaconda.com/download/#windows" target="_blank">Download</a> and install Anaconda for Windows. By using Anaconda, you can use manage separate environments for different distributions of Python. We **strongly** recommend using Python 3 as we do not guarantee supporting Python 2 in future releases. In this guide, we are using Python version 3.6 and Anaconda version 5.1 ([64-bit](https://repo.continuum.io/archive/Anaconda3-5.1.0-Windows-x86_64.exe) or [32-bit](https://repo.continuum.io/archive/Anaconda3-5.1.0-Windows-x86.exe) direct links).
<p align="center">
<img src="images/anaconda_install.PNG"
alt="Anaconda Install"
width="500" border="10" />
</p>
We recommend the default _advanced installation options_. However, select what would work for your specific situation.
<p align="center">
<img src="images/anaconda_default.PNG"
alt="Anaconda Install"
width="500" border="10" />
</p>
After installation, you will need to open __Anaconda Navigator__ to finish. From the Windows search bar, type _anaconda navigator_. You can close Anaconda Navigator after it opens.
## Step 5: Setup and Activate a New Conda Environment
You will create a new Conda environment to be used with ML-Agents. This means that all the packages that you install are localized to just this environment. It will not affect any other installation of Python or other environments. Whenever you want to run ML-Agents, you will need activate this Conda environment.
To create a new Conda environment, open a new Anaconda Prompt (_Anaconda Prompt_ in the search bar) and type in the following command:
conda create -n ml-agents python=3.6
You may be asked to install new packages. Type `y` and press enter _(make sure you are connected to the internet)_. You will need to install these packages. This command will create a new Conda environment called ml-agents using Python version 3.6.
<p align="center">
<img src="images/conda_new.PNG"
alt="Anaconda Install"
width="500" border="10" />
</p>
To use this environment, you will need to activate it. _(In the future, if you need to use this environment again, you can run the same command)_. In the same Anaconda Prompt, type in the following command:
conda activate ml-agents
You should see `(ml-agents)` prepended on the last line.
After this, you will need to install `tensorflow` and `tensorflow-gpu`. This can be installed by using `pip` - which is a package management system used to install Python packages. In the same Anaconda Prompt, type in the following command _(make sure you are connected to the internet)_:
pip install tensorflow tensorflow-gpu
Lastly, you should test to see if everything installed properly. You can do this to see if TensorFlow can identify your GPU. In the same Anaconda Prompt, type in the following command:
python
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
You should see something similar to:
```
Found device 0 with properties ...
```
## Step 6: Install Required Python Packages
ML-Agents includes a list of Python dependencies needed to run. Similarly in Step 5, you will be using `pip` to install these Python packages.
If you haven't already, make sure to clone the repository. You can do this using Git ([download here](https://git-scm.com/download/win)) and running the following commands in a new or same Anaconda Prompt (_if you closed the prompt from Step 5, you can activate the ml-agents Conda environment by typing `activate ml-agents`_):
git clone git@github.com:Unity-Technologies/ml-agents.git
If you don't want to use Git, you can always directly download all the files [here](https://github.com/Unity-Technologies/ml-agents/archive/master.zip).
In our example, the files are located in `C:\Downloads`. After you have either cloned or downloaded the files, from the Anaconda Prompt, change to the python directory inside the ML-agents directory:
cd C:\Downloads\ml-agents\python
Make sure you are connected to the internet and then type in the Anaconda Prompt:
pip install .
This will complete the installation of all the required Python packages to run ML-Agents.
正在加载...
取消
保存