Enhancing AI Research: Seamlessly Connecting RONIN's Jupyter Notebook to Google Colab
Google Colab is a free hosted Jupyter Notebook service that allows anybody to write and execute arbitrary python code in the cloud through the browser. It is a great place to store and share notebooks, especially since you can always access these notebooks from anywhere by easily storing them in Google Drive. However, Google Colab has its limitations with the free computational resources that it provides. RONIN allows you to completely customise your compute environment (RAM, CPUs, GPUs, Storage) based on the requirements of your python workflows. So connecting your Google Colab to a RONIN machine gives you all the benefits of the Google Colab platform, without being restricted by computational power. This blog post will walk you through all the steps you need to connect Google Colab to your RONIN machine.
1. Create a new Ubuntu 20.04 machine in RONIN
2. Open the machine in RONIN LINK and click the Jupyter LINK button in the "Connect to machine" modal to install Jupyter and ensure Jupyter opens successfully in your browser. More info here.
3. Remove the current Jupyter LINK from RONIN LINK
4. Connect to the terminal of your machine in RONIN LINK and run the following commands to stop the currently running notebook, and enable the required extension for Google Colab:
jupyter notebook stop
pip install jupyter_http_over_ws
jupyter server extension enable --py jupyter_http_over_ws
5. Restart your Jupyter notebook with the options to enable connection to Google Colab:
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0 --NotebookApp.disable_check_xsrf=true
Note: We recommend running this command in the background with screen so that you do not lose connection to your Jupyter notebook if the terminal disconnects.
6. Copy the output notebook URL that has “localhost” in it e.g. http://localhost:8888/tree?token=78a01b9f202690dcfc91a96624dd587bced3cdc963e52b7f
- you will need this in Step 8
7. At the bottom of the RONIN LINK "Connect to machine" modal create a secure port tunnel from your local machine on port 8888 to the RONIN Jupyter Notebook on port 8888. You can close the browser tab when it appears, but make sure you keep RONIN LINK open.
8. Open Google Colab, select the dropdown next to "Connect" and click "Connect to a local runtime". Paste in the URL from Step 6 in the modal that appears and click "Connect". Your Google Colab should then be connected to your RONIN Jupyter Notebook.
Note: Any time you want to re-connect to your Jupyter Notebook in Google Colab, ensure your RONIN machine is on, and then repeat steps 5-8. If you receive an error at any of the steps, try restarting your RONIN machine and/or your local machine.