> For the complete documentation index, see [llms.txt](https://docs.robbie.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.robbie.run/getting-started/remote-function-jupyter-notebook.md).

# Remote function - Jupyter Notebook

{% @storylane/embed subdomain="robbie" linkValue="vfe7iv3shjlv" url="<https://robbie.storylane.io/share/vfe7iv3shjlv>" %}

Robbie supports remotely running Python functions on GPUs in the Robbie cloud. Users typically choose this option if they have a specific task, such as a machine learning training loop, that needs the added performance of a GPU not available on their local machine.

See \`Using Robbie in Jupyter Notebooks\` for a more detailed explanation of when and how to use Robbie in your experimentation.

In this example, you will create a simple Jupyter Notebook on your local machine with one Python function that runs remotely on a GPU. (You can download the example here).

First, open a new notebook:

```
jupyter lab
```

Then create four new (empty) cells in the notebook.

In the first cell paste:

```
!pip install robbie torch
```

This will install the Robbie and PyTorch Python packages and their dependencies on your local computer.

In the second cell paste:

```
import robbie
robbie.login()
```

This will you and download your API key from Robbie and install it on your local machine.

In the third cell paste:

```
from robbie import remote

@remote(chooser_ui=True)
def your_function():
     # code (Add Matplotlib here)
```

In the fourth cell paste:

```
a = your_functions()
print(“a is:”, a)
```

This defines the Python function (`your_function()`) that will be run remotely in the Robbie cloud. Note that the `chooser_ui=True` argument tells Robbie to display a special UI in the notebook so that the end-user can choose the hardware to run the function.

Now Save the notebook (!\[A blue and white logo

Description automatically generated]\(/files/wtxZzimw5lNf6sM4lS0a) on a Mac or ![](/files/HTcq3Zd1BmkSIZCpmM9r) on Windows)

Start by pressing the ![](/files/5E5guPRTTXIqWXq9brDA) button to run the first cell.

You should see the Robbie and other packages being installed.

!\[A computer screen with white text

Description automatically generated]\(/files/N1USyhS6KehwpDmRfANC)

Next, run the second cell by pressing the ![](/files/LWuDDjFNTUkR0drDgvHx) button.

If you have yet to log into Robbie, you will be prompted for your username and password.

Finally, run the third cell. You should see a small GUI directly in the notebook.

![Robbie Remote Function Notebook GUI](/files/BqMb8ZAVqc4fyDmxTLN5)

From the `Hardware Options` dropdown menu, choose `NERC Small GPU`. This is a NVIDIA V100 GPU-based virtual instance in the Robbie cloud.

Next, tick the ![](/files/xyd9bXuScoxvc9fYmIBy) checkbox.

Next, press the !\[A green and black sign with a black arrow

Description automatically generated]\(/files/srK6p34dSewHBy24tkhV) button.

You should then see the command program executing.

!\[A screenshot of a computer program

Description automatically generated]\(/files/4EiGGqiCctCnvGwgX8qm)

!\[A screenshot of a computer

Description automatically generated]\(/files/UG4x1ooD0pgHZ9Hm4XaN)

So, what is Robbie doing here?

1. Created a new run (uniquely identified as `subtle_unicorn`) and allocated a GPU machine for your run.
2. Automatically detected your local Python dependencies (packages and versions), wrote them to a `requirements.txt` file, and sent them to the remote machine.
3. Packaged up (serialized) your function and arguments and sent it to the remote machine.
4. Vended a deep link to view the run progress, logs, and artifacts in the Robbie portal.
5. On the remote machine, Robbie installed the Python dependencies, unpackaged your function, executed it, and then returned the result to the local machine.
6. Streamed the standard out from the remote machine to your local machine, including the results of the `nvidia-smi` command.
7. Printed out the duration and cost of the job once it was complete

For more examples, see [Jupyter Notebook Examples](https://github.com/Positron-Networks/robbie-examples/tree/main/notebook_runner).


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.robbie.run/getting-started/remote-function-jupyter-notebook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
