-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ML-Agents for Windows Instructions #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
cd45be1
removed old instructions for windows
shihzy ba50ee2
Create Installation-Windows.md
shihzy b6b27cc
added header and windows 10 instructions
shihzy 64a8c4a
Update to Instructions
shihzy 89a97fb
screenshot for cuDNN membership required
shihzy 1d4a8f7
Update to instructions
shihzy 9b65a76
Updated with anaconda and GPU CUDA compatible
shihzy 395f407
Update with python package installs
shihzy 5112f6f
typo
shihzy 8f97639
Added in new conda environment steps and clean up
shihzy 6d62dab
typo
shihzy 5205c05
Included environment and path variables and typos
shihzy b1ebafe
Added acknowledgements and typos
shihzy b19f877
update instructions based on walk through on win
shihzy b6c61af
Minor updates
shihzy 46d8868
minor updates
shihzy f37a701
step 1 - install nvidia cuda image
shihzy 95769f1
cudnn zip and cuda directory
shihzy 108b6c1
environment variables updload
shihzy c9e1a2f
conda images
shihzy 572ffda
Delete conda_new.PNG
shihzy 1123b6b
updated conda image
shihzy 0406e82
added screenshots
shihzy e9b71b7
Cleaned up wording, final touches
shihzy fd919be
Updated to new doc from main installation
shihzy 58f4b2c
Using "a" VM
shihzy f1ae832
space between headers
shihzy 7a47024
Separated GPU based training as optional and adv.
shihzy 944388f
fixes duplicate "in this guide"
shihzy 088325c
Extra space
shihzy 5e9c1a5
cleaned up code markdowns
shihzy 4e6be5f
cleaned up code markdowns
shihzy d8b0169
you can use manage ---> you can manage
shihzy e024879
Moved test to see if tensorflow gpu is working
shihzy 6cd86a2
change to ML-agents Windows 10 support
shihzy 378bed7
Update to installing python and packages
shihzy ff692df
update on anaconda navigator
shihzy cf85d43
added link to conda environment
shihzy 2144abc
update to installing additional packages
shihzy 08c8214
update to activate
shihzy 6dd27c1
update to instructions for tensorflow and gpu
shihzy f1559e9
update to testing tensorflow gpu
shihzy 517c375
update to cloning git repo
shihzy c128100
typo
shihzy fdc0331
changed windows version
shihzy 9ecdb3b
python 3 required
shihzy 71debf7
seperated tensorflow and tensorflow-gpu
shihzy 6fb7191
Updated CUDA and cuDNN to working versions
shihzy 5bfab0f
removed CUDA screenshot
shihzy bb04df8
Delete install_nvidia_cuda_toolkit.PNG
shihzy 9d76a45
updated screenshots
shihzy 525cab4
Delete cuda_toolkit_directory.PNG
shihzy 3ca6427
Delete cudnn_zip_files.PNG
shihzy b9f30f5
Delete new_system_variable.PNG
shihzy f7a5828
Delete path_variables.PNG
shihzy 9a83437
Delete system_variable_name_value.PNG
shihzy 5b094fb
updated CUDA and cuDNN screenshots
shihzy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| # Installing ML-Agents for Windows | ||
|
|
||
| ML-Agents supports Windows 10. While it might be possible to run ML-Agents using other versions of Windows, it has not been tested on other versions. Furthermore, ML-Agents has not been tested on a Windows VM such as Bootcamp or Parallels. | ||
|
|
||
| To use ML-Agents, you install Python and the required Python packages as outlined below. This guide also covers how set up GPU-based training (for advanced users). GPU-based training is not required for the v0.3 release of ML-Agents. However, training on a GPU might be required by future versions and features. | ||
|
|
||
| ## 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 manage separate environments for different distributions of Python. Python 3 is required as we no longer support Python 2. 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 the options appropriate for your specific situation. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/anaconda_default.PNG" | ||
| alt="Anaconda Install" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| After installation, you must open __Anaconda Navigator__ to finish the setup. 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](https://conda.io/docs/) 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 must install these required packages. The new Conda environment is called ml-agents and uses 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 must activate it. _(To use this environment In the future, 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. | ||
|
|
||
| Next, install `tensorflow`. Install this package 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 | ||
| ``` | ||
|
|
||
| ## Step 3: Install Required Python Packages | ||
|
|
||
| ML-Agents depends on a number of Python packages. Use `pip` to install these Python dependencies. | ||
|
|
||
| If you haven't already, clone the ML-Agents Github repository to your local computer. You can do this using Git ([download here](https://git-scm.com/download/win)) and running the following commands in an Anaconda Prompt _(if you open a new prompt, be sure to 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). | ||
|
|
||
| As of ML-Agents v0.3, only CUDA 8 and cuDNN 6 is supported. | ||
|
|
||
| ## (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. In this guide, we are using version 8.0.61 ([direct link](https://developer.nvidia.com/compute/cuda/8.0/Prod2/network_installers/cuda_8.0.61_win10_network-exe)). | ||
|
|
||
| _Before installing, please make sure you __close any running instances of Unity or Visual Studio.___ | ||
|
|
||
| Run the installer and select the Express option. Note the directory where you installed the CUDA toolkit. In this guide, we installed in the directory `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0` | ||
|
|
||
| ## (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. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/cuDNN_membership_required.png" | ||
| alt="cuDNN membership required" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| Once you've signed up, go back to the cuDNN <a href="https://developer.nvidia.com/cudnn" target="_blank">downloads page</a>. You may or may not be asked to fill out a short survey. When you get to the list cuDNN releases, __make sure you are downloading the right version for the CUDA toolkit you installed in Step 1.__ In this guide, we are using version 6.0 for CUDA toolkit version 8.0 ([direct link](https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/8.0_20170307/cudnn-8.0-windows10-x64-v6.0-zip)). | ||
|
|
||
| After you have downloaded the cuDNN files, you will need to extract the files into the CUDA toolkit directory. In the cuDNN zip file, there are three folders called `bin`, `include`, and `lib`. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/cudnn_zip_files.PNG" | ||
| alt="cuDNN zip files" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| Copy these three folders into the CUDA toolkit directory. The CUDA toolkit directory is located at `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0` | ||
|
|
||
| <p align="center"> | ||
| <img src="images/cuda_toolkit_directory.PNG" | ||
| alt="cuda toolkit directory" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| ## (Optional) Step 3: Set Environment Variables | ||
|
|
||
| You will need to add one environment variable and two path variables. | ||
|
|
||
| To set the environment variable, type `environment variables` in the search bar (this can be reached by hitting the Windows key or the bottom left Windows button). You should see an option called __Edit the system environment variables__. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/edit_env_var.png" | ||
| alt="edit env variables" | ||
| width="250" border="10" /> | ||
| </p> | ||
|
|
||
| From here, click the __Environment Variables__ button. Click __New__ to add a new system variable _(make sure you do this under __System variables__ and not User variables_. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/new_system_variable.PNG" | ||
| alt="new system variable" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| For __Variable Name__, enter `CUDA_HOME`. For the variable value, put the directory location for the CUDA toolkit. In this guide, the directory location is `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0`. Press __OK__ once. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/system_variable_name_value.PNG" | ||
| alt="system variable names and values" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| To set the two path variables, inside the same __Environment Variables__ window and under the second box called __System Variables__, find a variable called `PATH` and click __Edit__. You will add two directories to the list. For this guide, the two entries would look like: | ||
|
|
||
| C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64 | ||
| C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64 | ||
|
|
||
| Make sure to replace the relevant directory location with the one you have installed. _Please note that case sensitivity matters_. | ||
|
|
||
| <p align="center"> | ||
| <img src="images/path_variables.PNG" | ||
| alt="Path variables" | ||
| width="500" border="10" /> | ||
| </p> | ||
|
|
||
| ## (Optional) Step 4: Install TensorFlow GPU | ||
| Next, install `tensorflow-gpu` using `pip`. In an Anaconda Prompt with the Conda environment ml-agents activated, type in the following command _(make sure you are connected to the internet)_: | ||
|
|
||
| ``` | ||
| pip install tensorflow-gpu | ||
| ``` | ||
|
|
||
| Lastly, you should test to see if everything installed properly and that 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 ... | ||
| ``` | ||
|
|
||
| ## Acknowledgements | ||
|
|
||
| We would like to thank [Jason Weimann](https://unity3d.college/2017/10/25/machine-learning-in-unity3d-setting-up-the-environment-tensorflow-for-agentml-on-windows-10/) and [Nitish S. Mutha](http://blog.nitishmutha.com/tensorflow/2017/01/22/TensorFlow-with-gpu-for-windows.html) for writing the original articles which were used to create this guide. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is also related with GPU, so maybe set it to optional also?