How to work with notebooks in Jupyterlab

An introduction and use of Jupyter notebooks in SageMaker

Documentation

How to work with notebooks in Jupyterlab

Jupyterlab Overview

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.

info_16 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.

launcher

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.

Terminal

Notebooks

We can use existing notebook samples or create new notebooks in Jupyterlab.

Use existing notebooks

info_16 Example Notebooks - SageMaker notebook samples

  1. 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.

    1. How to upload files to a notebook instance
      Use the Upload icon to upload files or drag the files to the directory column.

      upload

      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.

    2. How to clone a git repository to the notebook instance

      Clone the repository with samples to the notebook instance. Click on the git icon

      gitclone1

      A new dialog box appears for git URI. Add the git URI.

      gitclone2

  2. Open the notebook from uploaded files or from git folder
    open_notebook

  3. Select the kernel for notebook
    A dialogue box opens to select the kernel when we open the notebook. Select the kernel from the menu.
    kernel

Create new notebooks

Notebooks can be created from Launcher or File option.

  1. How to create a notebook from Launcher: ​

    Create a new notebook with conda_mxnet_p36 kernel.

    Select conda_mxnet_p36 from Notebook

    new_notebook

    A new notebook is created.

    empty_notebook

  2. How to create a notebook from File menu

    filemenu

    Select the kernel from the menu and a new notebook appears.

Run notebook cells

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.

tick Shortcut for running a cell- Select the cell and press Shift + Enter

Notebook Cells Overview

jupyter_1

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.

notebook_shortcuts

  • Save notebook
  • Add a cell below
  • Cut cell
  • Copy cell
  • Paste cell
  • Run cell
  • Stop call
  • Refresh notebook
  • Set cell as Code/Markdown
  • Changes in the notebook from last checkpoint
  • Git changes

The Run menu contains the options to run the cells one by one or all at once.

run_menu

Use the Edit menu to edit the cells.

edit_menu

Info

Project State

Public Project

Licences

Software Licence: Project has no software
Hardware Licence: Project has no hardware

Project Tags

Admins

SelenaS
emeusel
Nina_Boehm
MeyerMel
TimM
nwilson
jstoltz
TomE

Members

Does this project pique your interest?

Login or register to join or follow this project.

Comments
Back to top

Ready to join the project?

You'd like to participate ... Show more