Skip to content

yoheigon/sagemaker-unity-mlagents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using SageMaker For ML-Agents

Note: This tutorial supports only unity ml-agents v0.11.0.

Requirements

  • Unity Linux Build Support Component
  • Docker

Setup

  • Download the Unity Installer and add the Linux Build Support Component

  • Download and install Docker if you don't have it setup on your machine.

  • Since Docker runs a container in an environment that is isolated from the host machine, a mounted directory in your host machine is used to share data, e.g. the trainer configuration file, Unity executable, curriculum files and TensorFlow graph. For convenience, we created an empty unity-volume directory at the root of the repository for this purpose, but feel free to use any other directory. The remainder of this guide assumes that the unity-volume directory is the one used.

Usage

Using Docker for ML-Agents involves three steps: building the Unity environment with specific flags, building a Docker container and, finally, running the container. If you are not familiar with building a Unity environment for ML-Agents, please read through our Getting Started with the 3D Balance Ball Example guide first.

Build the Environment (Optional)

If you want to used the Editor to perform training, you can skip this step.

Since Docker typically runs a container sharing a (linux) kernel with the host machine, the Unity environment has to be built for the linux platform. When building a Unity environment, please select the following options from the the Build Settings window:

  • Set the Target Platform to Linux
  • Set the Architecture to x86_64
  • If the environment does not contain visual observations, you can select the headless option here.

Then click Build, pick an environment name (e.g. 3DBall) and set the output directory to unity-volume. After building, ensure that the file <environment-name>.x86_64 and subdirectory <environment-name>_Data/ are created under unity-volume.

Build Settings For Docker

Upload the Environment to S3

Upload the files under unity-volume to your S3 bucket.

Build the Docker Container

First, make sure the Docker engine is running on your machine. Then build the Docker container by calling the following command at the top-level of the repository:

docker build -t <image-name> .

Replace <image-name> with a name for the Docker image, e.g. balance.ball.v0.1.

Push the Docker Image to ECR

Push the docker image you created to AWS ECR. Pushing an Image

Run SageMaker Training Job

Use the uploaded files as input of SageMaker trainig job. The container performs training on the SageMaker training instance and automatically upload the output to your S3 bucket.

About

Using SageMaker For Unity ML-Agents

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •