Deep Learning Made Easy in Azure

This post was authored by Anusua Trivedi, Data Scientist, Microsoft and Jamie Olson, Analytics Solution Architect, Microsoft

Deep learning is an exciting new space for predictive modeling and machine learning and I’ve previously written about a variety of different models and tools in my previous blogs.  However, it can be intimidating to get started and frustrating to get everything installed and configured.  In this blog, we’ll show how you can jump-start your deep learning process with Jupyter Notebooks in Azure.

Introduction

Deep learning (DL) is responsible for recent advances in computer vision, speech recognition, natural language processing, audio recognition and multiple other breakthroughs. DL is a topic that is making big waves in research and industry alike.

However, before even you get to the fun part of DL, there’s a repetitive and cumbersome step – set up a deep learning framework of your choice with all its dependencies. And if you work with different Deep Learning frameworks on different platform with different dependencies, you know what a challenge this can be! It requires lots of time and effort to set-up your deep learning frameworks with GPU drivers, CUDA, MKL, and multiple other dependencies. So, we at Microsoft came up with two easy way options:

Both options include support for Jupyter notebooks.

Example deep learning notebook

Figure 1: Example deep learning notebook

The idea of notebooks containing both the results of a data science project and its source code developed in parallel in both the Python community, as IPython, as well as in the R community, as Sweave and knitr. The Jupyter project builds on IPython, providing a common platform for Python, R, SQL, and other languages, all within an interactive programmable notebook document. Jupyter notebooks can contain arbitrary text, mathematical formulas, source code, results, graphics, videos and many other kinds of media [Figure 1]. Whether you’re a newbie or a pro, the Jupyter notebook is a great choice for both data exploration as well as sharing your results.

Azure Notebook Service

Azure provides a service that you can use to quickly start using Jupyter. By using the Azure Notebook Service, you can easily gain access to Jupyter’s web-accessible interface to flexible computational resources with the power of R, Python and their many libraries. Since the notebook is a Microsoft-managed service, users can access these resources without the need for administration and configuration by the user.

Azure Notebooks have built-in support for Microsoft Cognitive Toolkit, commonly known as CNTK. So, if CNTK is your choice of DL Framework, all you need to do is upload your python notebooks in Azure Jupyter Service.  If you prefer using some other DL Framework (like Tensorflow, Keras or Theano), you can use Miniconda or pip (which is already installed) to install the DL framework of your choice with all dependences in the Azure Jupyter Service. For example, if you want to run Tensorflow notebooks, you need to run the command lines as in [Figure 2].

Installing Tensorflow in Azure Notebooks

Figure 2: Installing Tensorflow in Azure Notebooks

A key advantage of using a cloud-based notebook service is the ability to share your work, both privately and publicly.  Azure Notebooks let you organize your individual notebooks into groups called Libraries, which can be shared just by copying the link.  Other people will be able to see your notebooks and make their own copies, but not make changes to yours.

To help you get started on using DL models in Azure Notebooks, we put together a few sample notebook libraries:

Sayan Pathak, Principal SDE at Microsoft, put together a video guide on CNTK to help with the CNTK onboarding process. The Azure Notebook Service is currently in Preview and limited to CPU processing and has some memory and storage limits.  This creates a challenge for training large-scale deep learning models, but it’s a great place to experiment with the various modeling libraries.

DSVM Deep Learning Toolkit

You may want to consider the Azure GPU N-series virtual machines for more complex models or for training on larger datasets.  These VMs can be preinstalled with the DSVM Deep Learning Toolkit, which extends the Data Science Virtual Machine (DSVM) with deep learning tools.

The DSVM contains essential tools like Microsoft R, Anaconda Python, Jupyter notebooks and many other data science and ML tools. The DSVM Deep Learning Toolkit also provides GPU versions of MXNET and CNTK and is preconfigured for the N-series virtual machines, so you can easily install other deep learning frameworks (e.g. Tensorflow, Keras etc.). The NC GPUs are particularly well-suited for deep learning problems that require large datasets and computationally expensive training. The Deep Learning Toolkit also provides a set of sample deep learning solutions that use the GPUs.

Just like the DSVM, the Deep Learning Toolkit lets you use the familiar Jupyter interface to build and test your deep learning models.  However, unlike the Azure Notebook Service, the notebooks are tied to the specific virtual machine they’re running on, so make sure your work is properly backed up.

Conclusion

Whatever your data science needs, Azure offers flexible collaboration tools as well as the ability to scale up for real-world deep learning scenarios, all using tools familiar to the R and Python data science communities.

Anusua & Jamie