AWS Machine Learning Blog

Get Started with Deep Learning Using the AWS Deep Learning AMI

Whether you’re new to deep learning or want to build advanced deep learning projects in the cloud, it’s easy to get started by using AWS.

For users of all levels, AWS recommends Amazon SageMaker, a fully managed machine learning (ML) platform. The platform makes it straightforward to quickly and easily build, train, and deploy ML models at any scale without provisioning the machine yourself. There are also many AWS-only features to simplify deep learning, such as the following:

  • Experiments – Organize, track, and compare thousands of ML jobs; these can be training jobs or data processing and model evaluation jobs run with Amazon SageMaker Processing.
  • Debugger – Automatically introspect your models, collect debugging data, and analyze it to provide real-time alerts and advice on ways to optimize your training times and improve model quality.
  • Autopilot – Build models automatically with full control and visibility. Algorithm selection, data preprocessing, and model tuning are taken care of automatically, as well as all infrastructure.
  • Ground Truth – Reduce the time and effort required to create datasets for training.
  • Studio – Write code, track experiments, visualize data, and perform debugging and monitoring within a single integrated visual interface, which significantly boosts developer productivity.

For more information, see Getting Started with Amazon SageMaker.

This post focuses on the AWS Deep Learning AMIs (Amazon Machine Images), which let you build custom environments and workflows. Both Amazon SageMaker and the AMIs come preinstalled with popular open-source deep learning frameworks, including TensorFlow, Apache MXNet, PyTorch, and more, which are optimized for high performance on AWS.

You can use AMIs to train custom models, experiment with new algorithms, and learn new deep learning skills and techniques. There is no additional charge to use Deep Learning AMIs—you pay only for the AWS resources needed to store and run your applications.

The AMIs offer GPU acceleration through pre-configured CUDA and cuDNN drivers, and CPU acceleration through Intel MKL-DNN drivers. The AMIs are available for both Ubuntu (16 and 18) and Amazon Linux (1 and 2), and come bundled with popular data science and Python packages. You can choose either Conda AMIs with preinstalled frameworks and drivers in separate virtual environments, or base AMIs that allow end-to-end customization.

Launching your instance

To set up Deep Learning AMIs, first launch your instance. Complete the following steps:

  1. On the AWS Management Console, open the EC2 console.
  2. On the EC2 console, choose Launch Instance.

Installing your AMI

To install your AWS Deep Learning AMI, complete the following steps:

  1. On the AWS Marketplace, in the search bar, enter deep learning ami.
  2. From the list, locate AWS Deep Learning AMI (Ubuntu 18.04). This selection comes with the frameworks preinstalled. To set up custom builds of deep learning frameworks, choose the Deep Learning Base AMI. As of this writing, both AMIs are also available for Ubuntu
  3. Choose Select.
  4. On the Product Details pane, choose Continue.
  5. On the Choose Instance Type page, select an instance type for your deep learning training and deployment needs. This post uses a P3DN instance, the fastest instance type available on the cloud as of this writing.
  6. Choose Review and Launch.
  7. On the Review page, choose Launch.

    A pane appears and asks you to select a key pair.
  8. Choose Create a new key pair.
  9. For Key pair name, enter a name for your key pair.
  10. Choose Download Key Pair. Be sure to download your key pair to a safe location.
  11. Choose Launch Instances.

If your instance fails to launch because of an instance limit, you need to request an increase through the AWS Support Center.

Recording your instance’s public DNS

To find and record your instance’s public DNS, complete the following steps:

  1. On the EC2 console, under INSTANCES, choose Instances.
  2. From the list, select your new instance.
  3. On the Description tab, find your instance’s public DNS and record it to use in your next step.

Connecting to your instance

To connect to your instance, complete the following steps:

  1. Open your command line terminal.
  2. In the terminal, enter the following code to change to the directory where your security key is located, then connect to your instance using SSH:
    cd /Users/your_username/Downloads/
    chmod 0400 <your .pem file name>
    ssh -L localhost:8888:localhost:8888 -i <your .pem file name> ubuntu@<Your instance DNS>

    For <Your instance DNS>, use the DNS you copied earlier. When you connect, you’ll see a message of the day similar to the following:

  3. In the command line terminal, enter the code jupyter notebook.
  4. Record the URL indicated by the text Copy/paste this URL into your browser.

The following screenshot shows the results from the code you entered, and the URL to copy.

Starting a new notebook

To start a new notebook, complete the following steps:

  1. Open a new browser window.
  2. Navigate to the URL you copied earlier.
  3. Choose New.
  4. Start a new notebook using your preferred deep learning framework, such as TensorFlow, Apache MXNet, or PyTorch.

For more information about activating TensorFlow, Apache MXNet, or PyTorch frameworks for AMIs, see TensorFlow, Apache MXNET (incubating), and PyTorch, respectively.

Summary

Now that you’ve launched the AWS Deep Learning AMI, you can easily run tutorials for computer vision, natural language processing, recommendation systems, and more using your preferred deep learning framework. For more information, see What Is the AWS Deep Learning AMI?


About the Authors

Alex Chung is a Senior Product Manager with AWS in Deep Learning. His role is to make AWS Deep Learning products more accessible and cater to a wider audience. He’s passionate about social impact and technology, getting his regular gym workout, and cooking healthy meals.

 

 

 

Cynthya Peranandam is a Principal Marketing Manager for AWS artificial intelligence solutions, helping customers use deep learning to provide business value. In her spare time she likes to run and listen to music.