Local Runtime

  1. Install Docker.
  2. Start a google colab runtime.
# regular
docker run -p 127.0.0.1:9000:8080 us-docker.pkg.dev/colab-images/public/runtime

# nvidia gpu
paru -S nvidia-container-toolkit # on linux
sudo systemctl restart docker # on linux
docker run --gpus=all -p 127.0.0.1:9000:8080 us-docker.pkg.dev/colab-images/public/runtime
  1. (optional) Add name and mount local files.
--name <container-name>
-v <local-path>:<container-path>

# example
docker run --gpus=all -p 127.0.0.1:9000:8080 --name colab-runtime -v $HOME/Projects:/projects us-docker.pkg.dev/colab-images/public/runtime
start container with docker start <container-name> in the future
  1. Copy link from runtime output.
# example
http://127.0.0.1:9000/?token=chonktoken

Open in Google Colab Website

  1. Open https://colab.research.google.com/.
  2. Click Connect to a local machine and enter copied link.
If using firefox, enable insecure websocket preference
  1. Open about:config in firefox.
  2. Set network.websocket.allowInsecureFromHTTPS to true.

Open in VS Code

  1. Install required extensions.
    1. Python
    2. Pylance
    3. Python Debugger
    4. Jupyter Notebook Renderers
  2. Open command palette ctrl + shift + p.
  3. Search for Notebook: Select Notebook kernal.
  4. Click Select Another Kernal -> Existing Jupyter Server.
  5. Paste copied link, press Enter to confirm.
  6. Select python3 (ipykernal).