> For the complete documentation index, see [llms.txt](https://paperspace.gitbook.io/gradient/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paperspace.gitbook.io/gradient/explore-train-deploy/notebooks/notebook-containers.md).

# Runtimes

## Introduction to runtimes in Gradient Notebooks

In Gradient Notebooks, a runtime is defined by its container and workspace.

A workspace is the set of files managed by the Gradient Notebooks IDE while a container is the DockerHub or NVIDIA Container Registry image installed by Gradient.

A runtime does **not** specify a particular machine or instance type. One great benefit of Gradient Notebooks is that runtimes can be swapped across a wide variety of instances.

![Gradient Notebooks offers a list of Recommended runtimes. We can also select the All option to view a more expansive list of runtimes that work out of the box.](/files/jm0j1GsQzYasUNUv9AQl)

When creating a new notebook, Gradient offers a list of runtimes to select sorted by `Recommended` and `All`.  We can use these runtime tiles or we can create our own runtimes.

## How to use a runtime provided by Gradient

To explore the details of a particular runtime provided by Gradient, expand the **Advanced Options** section of the `Create a notebook` flow.

In this example, we will explore the PyTorch 1.10 runtime tile:

![A runtime combines a specific workspace with a specific container. We can adjust either property in the Advanced options tab when creating a new notebook.](/files/CxzWxBbooWOqH6oPSUKu)

The PyTorch 1.10 tile consists of the following:

* `Workspace URL` - <https://github.com/gradient-ai/PyTorch>
* `Container Name` - nvcr.io/nvidia/pytorch:21.10-py3

The `Workspace URL` parameter tells Gradient which files to load into the notebook file manager.&#x20;

The `Container Name` parameter tells Gradient where to fetch the container image that will be used to build the notebook.

When we select `Start Notebook`, Gradient imports the file(s) located in the `Workspace URL` directory into the file manager and then imports and runs the container image specified defined in the `Container Name` field.&#x20;

In this example, our new PyTorch 1.10 notebook contains the files from <https://github.com/gradient-ai/PyTorch> running on the container from nvcr.io/nvidia/pytorch:21.10-py3.

![The top box highlights the files in the file manager while the bottom box highlights the container. ](/files/gMLB21jYwdL6doTsLOHf)

We can confirm this fact by noticing that our file manager is populated with the contents from the GitHub repository (in this case a single file) and that the bottom bar is displaying the name of the container image as expected.

## List of base runtimes

Paperspace maintains a number of runtimes that make it easy to get started with preloaded notebook files and dependencies. These runtimes are provided as tiles when creating a new notebook in Gradient.

![A number of runtime tiles are provided when creating a new notebook. Tiles are sortable by Recommended or All using the blue sorting button.](/files/lUtPGjiwTzro7Ia1BdUk)

### Recommended runtimes

The following is a list of recommended runtimes that Paperspace maintains:

<table><thead><tr><th width="189">Name</th><th width="262">Description</th><th width="199">Container Name</th><th>Container Registry</th><th>Workspace URL</th></tr></thead><tbody><tr><td><em><strong>PyTorch 1.10</strong></em></td><td>Latest PyTorch release (1.8) with GPU support.</td><td><code>nvcr.io/nvidia/pytorch:21.09-py3</code></td><td><a href="https://hub.docker.com/r/pytorch/pytorch">DockerHub</a></td><td><a href="https://github.com/gradient-ai/PyTorch">https://github.com/gradient-ai/PyTorch</a></td></tr><tr><td><em><strong>TensorFlow 2.6.0</strong></em></td><td>TensorFlow 2 with GPU support.</td><td><code>nvcr.io/nvidia/tensorflow:21.09-tf2-py3</code></td><td><a href="https://hub.docker.com/r/tensorflow/tensorflow/">DockerHub</a></td><td><a href="https://github.com/gradient-ai/TensorFlow">https://github.com/gradient-ai/TensorFlow</a></td></tr><tr><td><em><strong>Paperspace + Fast.ai</strong></em></td><td><em><strong>Fast.ai</strong></em> Paperspace's Fast.ai template is built for getting up and running with the enormously popular <a href="http://www.fast.ai/">Fast.ai online MOOC</a>.</td><td><code>paperspace/fastai:2.0-CUDA9.2-fastbook-v0.1.0</code></td><td><a href="https://github.com/Paperspace/fastai-docker">GitHub</a></td><td><a href="https://github.com/fastai/fastbook.git">https://github.com/fastai/fastbook.git</a></td></tr><tr><td><em><strong>NVIDIA RAPIDS</strong></em></td><td>NVIDIA's library to execute end-to-end data science and analytics pipelines on GPU.</td><td><code>nvcr.io/nvidia/rapidsai/rapidsai:0.18-cuda11.0-base-centos7</code></td><td><a href="https://ngc.nvidia.com/catalog/containers/nvidia:rapidsai:rapidsai">NVIDIA</a></td><td><a href="https://github.com/gradient-ai/RAPIDS.git">https://github.com/gradient-ai/RAPIDS.git</a></td></tr><tr><td><em><strong>ClipIt-PixelDraw</strong></em></td><td>A creative library for generating pixel art from simple text prompts.</td><td><code>paperspace/clip-pixeldraw:jupyter</code></td><td><a href="https://hub.docker.com/r/paperspace/clip-pixeldraw">DockerHub</a></td><td><a href="https://github.com/gradient-ai/ClipIt-PixelDraw">https://github.com/gradient-ai/ClipIt-PixelDraw</a></td></tr><tr><td><em><strong>Hugging Face Transformers</strong></em>​</td><td>A state-of-the-art NLP library from Hugging Face</td><td><code>paperspace/transformers-gpu:0.4.0</code>​</td><td><a href="https://hub.docker.com/r/paperspace/transformers-gpu">DockerHub</a></td><td><a href="https://github.com/huggingface/transformers.git">https://github.com/huggingface/transformers.git</a></td></tr></tbody></table>

### Additional runtimes

These are a sampling of additional runtimes available in the `Create a notebook` section of the Gradient console. Runtimes are added frequently.&#x20;

| Name                                | Description                                     | Container Name                                                     | Container Registry                                                  | Workspace URL                          |
| ----------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------- | -------------------------------------- |
| ***Analytics Vidhya CV***           | Analytics Vidhya container                      | `jalfaizy/cv_docker:latest`                                        | [GitHub](https://github.com/ufoym/deepo)                            | N/A                                    |
| ***TensorFlow (1.14 GPU)***         | Official docker images for TensorFlow version 1 | `paperspace/dl-containers:tensorflow1140-py36-cu100-cdnn7-jupyter` | [DockerHub](https://hub.docker.com/r/tensorflow/tensorflow/)        | N/A                                    |
| ***JupyterLab Data Science Stack*** | Jupyter Notebook Data Science Stack             | `jupyter/datascience-notebook`                                     | [DockerHub](https://hub.docker.com/r/jupyter/datascience-notebook/) | N/A                                    |
| ***JupyterLab Data R Stack***       | Jupyter Notebook R Stack                        | `jupyter/r-notebook`                                               | [DockerHub](https://hub.docker.com/r/jupyter/r-notebook/)           | <https://github.com/gradient-ai/R.git> |

## How to specify a custom workspace

Gradient provides the ability to import a workspace during notebook creation.&#x20;

Let's say we're interested in working with [GFP-GAN](https://github.com/gradient-ai/GFPGAN), an exciting library that helps us restore and upscale images. Rather than clone the files from GitHub after we create the notebook, we can instantiate the notebook with the files already there.&#x20;

All we need to do is specify the GFP-GAN GitHub repo in the `Workspace URL` parameter of `Advanced options` during notebook creation.&#x20;

![To import a GitHub repository when creating a notebook we can include the repo URL in the Workspace URL field.](/files/LW69aMquJhOhymGsc5HI)

Gradient automatically copies all of the files from the GitHub repo into the notebook IDE.&#x20;

The resulting notebook looks like this:

![GFPGAN files have successfully imported into the notebook.](/files/4V8vSKoCoxgHn5NO8Vg0)

A custom workspace can be specified at the time of notebook creation only.

It's also possible to pull files from private or password-protected repositories by filling in `Workspace Username` and `Workspace Password` fields.&#x20;

![The Workspace Username and Workspace Password fields are useful for pulling files from private GitHub repositories.](/files/OgjzB40rKAljw4qo3Pa2)

The same logic can be applied to containers, which is demonstrated in the next section.

## How to specify a custom container

A container is a disk image pre-loaded with files and dependencies. Gradient provides the ability to import an image from a container registry such as DockerHub during notebook creation.

In this example, we'll tell Gradient to pull the latest container from [NVIDIA RAPIDS](https://rapids.ai/start.html#get-rapids) by specifying the Docker image in the `Container Name` field.

![To pull the latest NVIDIA RAPIDS image, we can specify the DockerHub address in the Container Name field.](/files/xfd7CSevgfWXYDL5kOqP)

Note that the larger the container, the longer it will take for Gradient to pull it into a notebook.

## How to create a custom Docker container to use with Gradient Notebooks

Paperspace recommends using [Docker](https://www.docker.com/) to get the container image from the local machine to Gradient.&#x20;

`jupyter` must be run on port `8888` and connections from ip address `0.0.0.0` must be allowed.

If running `jupyter notebook`, the following flags must be included in the `Command` field to support the Gradient Notebooks IDE:

```
--no-browser --NotebookApp.trust_xheaders=True --NotebookApp.disable_check_xsrf=False --NotebookApp.allow_remote_access=True --NotebookApp.allow_origin='*' 
```

If running `jupyter lab`, these flags should be used in the `Command` field instead:

```
--no-browser --LabApp.trust_xheaders=True --LabApp.disable_check_xsrf=False --LabApp.allow_remote_access=True --LabApp.allow_origin='*'
```

## Custom container reference

The following fields are available in the `Container` section of `Advanced options` when creating a new Gradient Notebook:

![The Container section of Advanced options in the Create a notebook flow in Gradient.](/files/-MW5R7S4morn_MGQk-AY)

<table><thead><tr><th width="227">Field</th><th width="150">Required</th><th>Description</th></tr></thead><tbody><tr><td>Container Name</td><td>true</td><td>Path and tags of image from DockerHub or NVIDIA Container Registry. E.g. <code>ufoym/deepo:all-jupyter-py36</code></td></tr><tr><td>Registry Username</td><td>false</td><td>Private container registry username. Can be left blank for public images.</td></tr><tr><td>Registry Password</td><td>false</td><td>Private container registry password. Can be left blank for public images. Secrets may be used in this field using the substitution syntax <code>secret:</code></td></tr><tr><td>Command</td><td>false</td><td>Must be Jupyter compatible. If left blank, defaults to <code>jupyter notebook --allow-root --ip=0.0.0.0 --no-browser --NotebookApp.trust_xheaders=True --NotebookApp.disable_check_xsrf=False --NotebookApp.allow_remote_access=True --NotebookApp.allow_origin='*'</code></td></tr><tr><td>Container User</td><td>false</td><td>Optional user. Defaults to 'root' if left blank.</td></tr></tbody></table>

##


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://paperspace.gitbook.io/gradient/explore-train-deploy/notebooks/notebook-containers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
