18.2. Using Amazon SageMaker
Open the notebook in Colab

Many deep learning applications require significant amounts of computation. Your local machine might be too slow to solve these problems in a reasonable amount of time. Cloud computing services can give you access to more powerful computers to run the GPU intensive portions of this book. This tutorial will guide you through Amazon SageMaker: a service that allows you to be up and running notebooks easily.

18.2.1. Registering Account and Logging In

First, we need to register an account at https://aws.amazon.com/. We strongly encourage you to use two-factor authentication for additional security. Furthermore, it is a good idea to set up detailed billing and spending alerts to avoid any unexpected surprises if you forget to suspend your computers. Note that you will need a credit card. After logging into your AWS account, find “SageMaker” (see Fig. 18.2.1) to go to the SageMaker panel.


Fig. 18.2.1 Open the SageMaker console.

18.2.2. Creating an SageMaker Instance

Next let’s create a notebook instance (Fig. 18.2.2). During the creation, we can specify the instance name, type (Fig. 18.2.3), and notebook repository URL (Fig. 18.2.4). SageMaker provides multiple instance types with different computation power and price. We used ml.p3.2xlarge here. It has one Tesla V100 GPU and an 8-core CPU, which is powerful enough for most chapters. A Jupyter notebook version of this book that is modified to fit SageMaker is available at https://github.com/d2l-ai/d2l-en-sagemaker. We can specify this URL to let SageMaker clone this repository during instance creation.


Fig. 18.2.2 Create a notebook instance.


Fig. 18.2.3 Select instance type.


Fig. 18.2.4 Specify the notebook repository.

18.2.3. Running and Stopping an Instance

You may need to wait a few minutes before the instance is ready. Then you can click on the “Open Jupyter” link (Fig. 18.2.5) to navigate to the Jupyter server running on this instance (Fig. 18.2.6). The usage is similar to a normal Jupyter server running locally (Section 18.1). After finishing your work, don’t forgot to stop the instance to avoid further charging.


Fig. 18.2.5 Open Jupyter on the created instance.


Fig. 18.2.6 The Jupyter server running on the SageMaker instance.


Fig. 18.2.7 Stop your instance.

18.2.4. Updating Notebooks

We will regularly update the notebooks in the d2l-ai/d2l-en-sagemaker repository. You can simply git pull to update to the latest version. To do so, first open a terminal (Fig. 18.2.8).


Fig. 18.2.8 Specify the notebook repository.

You may want to commit your local changes first before pulling the updates. Or you can simply ignore all your changes by running git reset --hard. You can copy paste the following codes in the terminal to do so:

cd SageMaker/d2l-en-sagemaker/
git reset --hard
git pull

18.2.5. Summary

  • Cloud computing services offer a wide variety of GPU servers.

  • You can launch and stop a Jupyter server through Amazon SageMaker easily.