Connecting Google Colab to an Amazon EC2 instance

Connecting Google Colab to an Amazon EC2 instance

Connecting Google Colab to an Amazon EC2 instance

Before delving into the tutorial. Let’s talk a bit about Jupyter Notebooks.

Jupyter

Jupyter is a free, open-source, shareable, and interactive web application that allows the user to combine code, computational output, visualizations, text, and media.

Jupyter notebooks have become the data scientist’s computational tool of choice. The name is made up of Julia, python, and R, three of the currently supported 40+ programming languages by Jupyter at the moment.

Problems with Notebooks

Notebooks are not all great. Some issues associated with using notebooks include —

Notebooks run into problems when running long asynchronous tasks. Training a model for many hours or for days as is typical in Deep Learning can become tedious especially when the display times out . A workaround to this would be to regularly checkpoint the model weights and to write the log file to disk.

Errors returned when the notebook is run out of order (It should be noted this is more of a user issue)

It encourages poor software engineering practices. E.g lack of unit tests, and writing code into reusable chunks.

Many, however, would argue none of these should be considered issues since notebooks were never designed to address those. It works great for quick experimentation and prototyping. It is more than possible to move code into scripts and still call them from within notebooks.

Jupyter notebooks are a tool for exploration not for production

Colab

Google Colaboratory is a free Jupyter-based notebook environment that runs on google’s cloud servers, allowing the user to leverage hardware (CPU, GPU, and TPU) provided by Google. The last two of which are quite useful for data scientists and machine learning engineers. Another advantage to using Colab is that it allows access to google drive which may be mounted and accessed through the file explorer. Colab also comes with a suite of deep learning libraries like TensorFlow and Keras pre-installed.

Google Colab provides a 12GB NVIDIA Tesla K80 GPU with an Nvidia compute capability of 3.7 that may be used for up to 12 hours continuously. While this is great for experimenting and prototyping, one very quickly runs into limitations when working with large datasets, and/or larger networks.

Before we get to the tutorial, it’s important to note that this does not only apply to Amazon’s EC2 instance but could also be used with Google Cloud’s Compute Engine, Microsoft Azure’s Virtual machines, and even a local setup.

Connecting an external runtime to Colab simply allows one to keep the Colab interface while using GPU acceleration other than the one provided by Colab by default.

Using AWS, many people prefer to use Sagemaker since it takes care of the nitty-gritty of creating an EC2 instance in the background and setting up a Jupyter notebook connection, this makes SageMaker more expensive compared to EC2. Creating an EC2 instance and connecting it to a Colab notebook is, therefore, cheaper than using SageMaker while getting to keep the preferred(by many) Colab interface.

Comparing costs, a p3.2xlarge instance on EC2 in the Ohio region costs $3.06 per hour, while the same instance on SageMaker costs $3.825 in the same region.

Let’s dive in.

machine-learning aws colab azure

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Hire Machine Learning Engineer | Offshore Machine Learning Experts

We are a Machine Learning Services provider offering custom AI solutions, Machine Learning as a service & deep learning solutions. Hire Machine Learning experts & build AI Chatbots, Neural networks, etc. 16+ yrs & 2500+ clients.

Azure Machine Learning Service

In a series of blog posts, I am planning to write down my experiences of training, deploying and managing models and running pipelines with Azure Machine Learning Service.

5 Latest Technology Trends of Machine Learning for 2021

Check out the 5 latest technologies of machine learning trends to boost business growth in 2021 by considering the best version of digital development tools. It is the right time to accelerate user experience by bringing advancement in their lifestyle.

Hire Machine Learning Developers in India

We supply you with world class machine learning experts / ML Developers with years of domain experience who can add more value to your business.

Applications of machine learning in different industry domains

We supply you with world class machine learning experts / ML Developers with years of domain experience who can add more value to your business.