5 minutes to #DeepLearning on #Azure #DataScience GPUs VM with #Docker #NvidiaDigits #Caffe

Shared previously on twitter but for the record, it’s really very easy to get a glimpse of Deep Learning on the new Linux GPUs powered Azure Data Science VMs. No code required aside from provided shell/nvidia-docker command line below.


We’ll be using Nvidia digits, that wraps Caffe deep learning framework, will do all the heavy lifting for you.

If you don’t have an Azure Subcription you can get a trial easily



Create the DataScience Linux VM

be sure to select HDD and NC series VM (with K80 GPUs)


Wait a few moments until it’s available for remote connections

Connect to the Linux VM using SSH (ex: putty, mobaxterm)

you can run dvsm-more-info to get a guide of what’s available, pretty much everything you need Smile


Start Digits Docker container with nvidia-docker, download & prepare mnist dataset

shell code: (also available here)

sudo usermod -aG docker $USER && \

mkdir ~/data && \

mkdir ~/digits-jobs && \

nvidia-docker run –name digits -d -v ~/data:/data -v ~/digits-jobs:/jobs -p 5000:5000 nvidia/digits && \

docker exec -it digits python -m digits.download_data mnist /data/mnist

this will:

  1. add current user to docker group so you don’t need to sudo constantly to use docker
  2. create data and digits-jobs host folders for persisting data and digits jobs outside of the container
  3. run the digits container (default gpu based, exposing digits port 5000, using nvidia-docker as to use the host GPUs)
  4. executing python script inside container to download & prepare mnist dataset

God, I love Docker….! (thank you Pedro Sousa, owe you for life! Smile )


SSH Tunnel for digits http/5000

Now, digits has no real authentication so I suggest you configure ssh port tunnel (don’t expose this endpoint!), so that you can open http://localhost:5000 on your laptop and will open the remote digits endpoint running on docker container running on azure data science vm host Smile.

Open Nvidia digits on http://localhost:5000

You may have to wait a few seconds, and then should open on your local browser.

You can follow the guide here, no code needed: Getting Started (NVidia Digits) 

No more code required to train your first deep convolutional network with GPUs and get 99% accuracy on mnist handwritten digits dataset. Should take only a few minutes

note: path for mnist data is /data/mnist/train for use when creating the dataset, you don’t need to download the mnist data again


Some additional screens

Exploring dataset images


Training default LeNet network


Network config


Digits built-in network visualizer


GPU training (1 tesla K80)



done, ~1min 37 seconds


testing trained model/epoch


it works!


activations, filter weights,…



Persisted mnist data and digits jobs on host vm

so you can stop docker/container if needed, later start a completely new docker container and continue where you left off


Having shown digits nocode approach here, the really truly inspiring is getting to know how this convolutional neural networks work and how they learn the filters on their own (they learn the $”%#@#”"&% reusable filters/weights! then how to use them to build other filters…and so on). Absolutely amazing.

If you’re interested few good sessions.

Tensorflow and deep learning – without a PhD by Martin Görner 

How Deep Neural Networks Work- Brandon Rohrer

Take care!



About Rui Quintino
Developer & Software Architect @ DevScope

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: