Skip to main content

Google Colab secure shell connection helper that automates ngrok tunnels creation (for SSH, TPU & TensorBoard) and facilitates Kaggle API data downloads.

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. sshColab automates the tedious routine to set up ngrok tunnels needed for TPU runtime applications and services like TensorBoard. It also includes the function to facilitate the routine of Kaggle API installation/authentication and competition data downloads.

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 sshColab. Type and run the following command in a notebook cell:

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

    import sshColab
    sshColab.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:

    sshColab.info()
    

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

  5. Run function kaggle() to automate Kaggle API installation/authentication and data downloads. The data is unzipped to the destination folder /kaggle/input.

    sshColab.kaggle([data='name-of-competition'])
    

    Note that the default competition name is "tabular-playground-series-mar-2021."

  6. To disable ngrok tunnels created, run the command below:

    sshColab.kill()
    

Quickstart

A quickstart Colab notebook template is provided in the link below. Users can find a simple end-to-end application starting from sshColab 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

Release

Version 0.2.0: Addition of Google Drive mounting.

Version 0.1.3: Addition of Kaggle API installation/authentication and competition data downloading function.

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.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

ssh_Colab-0.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file ssh-Colab-0.2.0.tar.gz.

File metadata

  • Download URL: ssh-Colab-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/54.1.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for ssh-Colab-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3c595bd918263ef541119843a925239e33948a40949fcce40a720c20bbed858a
MD5 4ef3aa260cf135b1b9416bf755cdd6fd
BLAKE2b-256 61e970a5b2ba1534f28c455629be1678395bbe5fb5877d52213b98a6c2c51168

See more details on using hashes here.

File details

Details for the file ssh_Colab-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ssh_Colab-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/54.1.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for ssh_Colab-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 558daad036e425798282d275dee482027fca63103a053a74d80446817d47e8be
MD5 cd61a238446c0f60448c7668e6c05be2
BLAKE2b-256 bb811da18de70d3244314ca6af69b6ad9aee03a3fc57f1acb5b8c78f2a2c781e

See more details on using hashes here.

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