Working in Jupyter Notebooks
You can run Beam functions from Jupyter Notebook cells, which is useful for outsourcing heavy computation to Beam’s serverless cloud.
Beam works in local notebooks and cloud notebooks like Google Colab.
View the Example Notebook
Try out an example Jupyter Notebook
Initial Setup
The first is installing beam-client
and adding your Beam credentials to the notebook:
# Colab Setup: Install beam-client
!pip install beam-client
# Import the Beam client
import beam
# Add your Beam API key
!beam configure default --token [YOUR-BEAM-TOKEN]
!beam config select default
Running Functions
Your local notebook server has access to the Beam credentials on your computer, so you can run Beam functions in the notebook cells like you normally would.
You can run GPU accelerated functions, mount storage volumes, and use the full-functionality of Beam from the notebook.
Launching a Local Notebook Server
You can spin up a local Jupyter notebook server using the jupyter
CLI.
If you already have a local Jupyter environment, you can skip this step.
If you don’t have it installed yet, you can do it with pip
:
pip3 install --upgrade pip && pip3 install jupyter
Launch the notebook server. The typically opens the server on localhost:8888
.
jupyter notebook
Was this page helpful?