Connect GPU to Google Colab
Connecting a Hyperbolic GPU to Google Colab as a Local Runtime
This guide walks you through connecting a GPU rented from the Hyperbolic GPU Marketplace to Google Colab as a local runtime. It is based on Google Colab's official documentation.
Step 1: Rent and Configure the GPU Instance
Rent a GPU instance (e.g., NVIDIA H100 SXM) from Hyperbolic.
In HTTP Port Selection, expose port 8888.
Press connect and wait for the instance to start up, should take less than 1 minute. Once started, copy the ssh command.
Step 2: Connect via SSH and Install Dependencies
Once the instance is running, open a Terminal and follow the steps below:
#Connect via SSH (example command)
ssh [[email protected]](mailto:[email protected]) -p 31671
#Update and install pip
sudo apt update
sudo apt install python3-pip -y
#Install Jupyter Notebook
pip install notebook
#Add Jupyter to PATH
export PATH="$HOME/.local/bin:$PATH"
Step 3: Start the Jupyter Notebook Server
jupyter notebook \
--NotebookApp.allow_origin='https://colab.research.google.com' \
--port=8888 \
--NotebookApp.port_retries=0
Copy the output URL and save. This contains your Jupyter token which will be used later.
# example Jupyter token url
http\://localhost:8888/tree?token=04ebf1c8dbb123cb4d4179cd482ad26d99ed5467cbe111b7
Step 4: Establish SSH Tunnel for Port Forwarding
In a new Terminal tab, copy and paste the SSH command once again, but modify to include -L 8888:localhost:8888
# example ssh connection URL
ssh -L 8888:localhost:8888 [email protected] -p 31671
Keep both terminal sessions open.
Step 5: Connect Colab to Local Runtime
- Open a Colab notebook.
- Click the top-right Connect dropdown > Connect to a local runtime.
- Paste your copied URL from earlier, and remove "tree"
Example Base URL:
http\://localhost:8888/tree?token=04ebf1c8dbb928cb4d4179cd482ad26d99ed8094cbebbbb7
Modify it to:
http\://localhost:8888/?token=04ebf1c8dbb928cb4d4179cd482ad26d99ed8094cbebbbb7
- Click Connect.
Step 6: Confirmation
Check the original terminal for a Colab kernel connection message. You are now connected to your Hyperbolic GPU instance!
Happy computing!
Updated about 3 hours ago