Skip to main content

Google Colab Secure Shell connector that automates Ngrok tunnels creation for SSH, TPU and TensorBoard and Kaggle API installation

Project description

ssh_Colab

ssh_Colab is a Python module to facilitate remote access to Google Colaboratory (Colab) through Secure Shell (SSH) connections, secured by a third-party software, ngrok. ssh_Colab automates the tedious routine to set up ngrok tunnels needed for TPU runtime applications and services like TensorBoard. It also includes the function to automate the routine of Kaggle API installation/authentication and download competition data.

license python version

Prerequisites

  • ngrok tunnel authtoken.
  • Google account to access a Colab notebook.
  • Local code editors such as VS Code or PyCharm to make the most of coding on Colab.

Usage

  1. Launch a Colab notebook. Choose a runtime type you prefer.

  2. Install ssh_Colab. Type and run the following command in a notebook cell:

    !pip install ssh_Colab
    
  3. Initiate the establishment of tunnels:

    import ssh_Colab
    ssh_Colab.connect()
    

    The default TensorBoard log directory is /log/fit. You can reset it by passing into connect() the new value LOG_DIR=/new/path/to/log.

  4. Retrieve information that is used for establishing the SSH connection:

    ssh_Colab.info()
    

    If you are using non-TPU runtimes, the setup instruction of TPU resolver is ignored.

  5. Function kaggle() to automate most of the process of Kaggle API installation/authentication and download and unzip competition dataset to folder /kaggle/input. The default competition name is "tabular-playground-series-mar-2021."

    ssh_Colab.kaggle([data='name-of-competition'])
    
  6. To disable ngrok tunnels created, run the command below:

    ssh_Colab.kill()
    

Quickstart

A quickstart Colab notebook template is provided in the link below. Users can find a simple end-to-end application starting from SSH-Colab installation, SSH tunnel creation, to the use of TensorBoard after training a 3-layer MNIST convolutional neural network.

Open In Colab

What's missed in this quickstart is how to may our way to Colab instances from local machines. The reference listed below can be a start point for interested users:

  1. Remote development over SSH on local VS Code
  2. Run SSH terminal on local PyCharm

Feedback

Comments and suggestions are welcome and appreciated. They can be sent to lipin.juan02@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssh_Colab-0.1.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

ssh_Colab-0.1.0-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page