2.2 KiB
Training on Amazon Web Service
This page contains instructions for setting up an EC2 instance on Amazon Web Service for training ML-Agents environments. Visual observations is not supported currently and you need to enable headless mode.
Recommended AMI
You can get started with an EC2 instance with the Deep Learning AMI (Ubuntu) listed under AWS Marketplace AMI. Choose the python3 environment within that ami which gives you the python3 and CUDA 9.0 environment.
Configuring your own Instance
To begin with, you will need an EC2 instance which contains the latest Nvidia drivers, CUDA9, and cuDNN. There are a number of external tutorials which describe this (Note: You will need to tweak some steps in these tutorials for CUDA 9):
- Getting CUDA 8 to Work With openAI Gym on AWS and Compiling TensorFlow for CUDA 8 Compatibility
- Installing TensorFlow on an AWS EC2 P2 GPU Instance
- Updating Nvidia CUDA to 8.0.x in Ubuntu 16.04 – EC2 Gx instance
Installing ML-Agents
- Move
python
sub-folder of this ml-agents repo to the remote ECS instance, and set it as the working directory. - Install the required packages with
pip3 install .
.
Testing
To verify that all steps worked correctly:
- In the Unity Editor, load a project containing an ML-Agents environment (you can use one of the example environments if you have not created your own).
- Open the Build Settings window (menu: File > Build Settings).
- Select Linux as the Target Platform, and x86_64 as the target architecture.
- Check Headless Mode.
- Click Build to build the Unity environment executable.
- Upload the executable to your EC2 instance.
- Test the instance setup from Python using:
from unityagents import UnityEnvironment
env = UnityEnvironment(<your_env>)
Where <your_env>
corresponds to the path to your environment executable.
You should receive a message confirming that the environment was loaded successfully.