An introduction and use of Jupyter notebooks in SageMaker
The Open Jupyterlab provides an integrated environment with easy access to files, git, and other features. Initially, we have the Launcher window. Some of the features in the notebook instance are explained below.
SageMaker notebook instances use conda environments to implement different kernels for Jupyter notebooks. Conda is an open-source package- and environment management system that helps in the quick installation of software packages and their dependencies. A conda environment is a directory that contains a specific collection of conda packages that are installed.
a) It contains the links to (explained one by one) Sessions running, repository, Appearance, Tab options available, Table of contents, and finally SageMaker Examples.
b) Upload the files from Computer to Notebook instance.
c) Create a new notebook(.ipynb file) with python 3.6 and TensorFlow kernel with Elastic Inference. This notebook can be used to work with the TensorFlow framework. The kernel with conda_python3_tensorflow enables SageMaker Python SDK with MXNet and so on.
d) Use Console instead of a notebook for operations. In Console operation, only one cell is executed at a time.
e) Opens the terminal for the instance and here is the beginning of the EB2 volume.
We can use existing notebook samples or create new notebooks in Jupyterlab.
Example Notebooks - SageMaker notebook samples
The first step is to upload the notebook and required files to the Jupyterlab. Jupyterlab provides options to upload files directly and clone a repository. Select one of the options.
How to upload files to a notebook instance
Use the Upload icon to upload files or drag the files to the directory column.
Create a new folder to upload the folder contents. Use the New Folder icon to create a new folder. Now upload the files to the folder.
How to clone a git repository to the notebook instance
Clone the repository with samples to the notebook instance. Click on the git icon
A new dialog box appears for git URI. Add the git URI.
Open the notebook from uploaded files or from git folder
Select the kernel for notebook
A dialogue box opens to select the kernel when we open the notebook. Select the kernel from the menu.
Notebooks can be created from Launcher or File option.
How to create a notebook from Launcher:
Create a new notebook with conda_mxnet_p36 kernel.
Select conda_mxnet_p36 from Notebook
A new notebook is created.
How to create a notebook from File menu
Select the kernel from the menu and a new notebook appears.
Notebooks contain markdown cells and code cells. Markdown cells can be used for documentation and code cells for the code segments. Individual cells or all cells in a notebook can be run at a time. Select a cell by clicking on it.
Shortcut for running a cell- Select the cell and press Shift + Enter
Notebook Cells Overview
The fields marked in green indicate Kernels of the notebook and in red indicate the markdown cells. Suppose if you need to change the kernel of the working notebook, we can change it directly by clicking on the current kernel, i.e., conda_mxnet_p36. Similarly, the cell can be changed to code or markdown by selecting from the options Markdown/Code.
The Notebook buttons explained from left to right as in image.
The Run menu contains the options to run the cells one by one or all at once.
Use the Edit menu to edit the cells.
You'd like to participate ...
Show more