lunedì 18 novembre 2019

See you at the Big Things Conference 2019 in Madrid on Wednesday or Thursday!

I hope you are going to attend the 8th edition of Big Things 2019, the data and AI conference which will happen in Madrid (Spain) on November 20th and 21st. This conference started in 2012 and this year changed its name from Big Data Spain to Big Things, as it became focused not only on Big Data, but also on whatever is related to AI.
Among the speakers this year there will be big names such as Cassie Kozyrkov, Alberto Cairo, Jesse Anderson, Michael Armbrust, Suneel Marthi, Paco Nathan and many others.
My talk will be on Thursday 21st at 1:55 PM local time. I am going to give an update on importing and re-training Keras/TensorFlow models in DL4J and Apache Spark. It is a follow-up of some of the topics covered in my book, considering changes related to new releases of DL4J, Keras and TensorFlow since it has been published in January this year.



Please stop by if you are going to attend my talk and the conference. I really appreciated the conversations about Deep Learning I had with all those people who got in touch with me in person at the Big Data Moscow and Spark+AI Summit Amsterdam. Networking is the greatest value when attending conferences.

giovedì 14 novembre 2019

How to install Anaconda or Miniconda in Colab

Colab is the Google's platform for working with Python notebooks and practice Deep Learning using different frameworks. It is a powerful platform, there is availability of GPUs or TPUs, it allows to use your Google Drive space for notebooks and data, has a friendly user interface and lots of useful features, but in order to install/update Python packages, it comes by default only with pip and no availability for conda. If you need to import a Python package which is available in Anaconda, but not in PyPi you need to install Anaconda or Miniconda yourself from a notebook. In this post I am explaining the simple steps to do it.

Anaconda installation
Create your notebook and from a code cell download the Anaconda installer:

!wget -c https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh

This is the version that works fine for me. I have tried also with the latest release 2019.10, but the configuration then would have extra complexity.

Now you need to make the downloaded file executable:

!chmod +x Anaconda3-5.1.0-Linux-x86_64.sh

and then you can run it:

!bash ./Anaconda3-5.1.0-Linux-x86_64.sh -b -f -p /usr/local

Before installing packages, a last configuration setting is needed:

import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')


This way the path to the packages managed through conda has been appended to the PYTHONPATH environment variable.

Miniconda installation
In most cased Miniconda would be enough. This is the way you can install it.
Create your notebook and from a code cell download the installer:

!wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh

Make it executable:

!chmod +x Miniconda3-4.5.4-Linux-x86_64.sh

and finally execute it.

!bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local

And you're ready to go.

martedì 12 novembre 2019

Using Rapids cuDF in a Colab notebook

During last Spark+AI Summit Europe 2019 I had a chance to attend a talk from Miguel Martinez who was presenting Rapids, the new Open Source framework from NVIDIA for GPU accelerated end-to-end Data Science and Analytics.


Fig. 1 - Overview of the Rapids eco-system

Rapids is a suite of Open Source libraries:

  • cuDF
  • cuML
  • cuGraph
  • cuXFilter

I enjoied the presentation and liked the idea of this initiative, so I wanted to start playing with the Rapids libraries in Python on Colab, starting from cuDF, but the first attempt came with an issue that I eventually solved. So in this post I am going to share how I fixed it, with the hope it would be useful to someone else running into the same blocker.
I am assuming here you are already familiar with Google Colab. I am using Python 3.x as Python 2 isn't supported by Rapids.
Once you have created a new notebook in Colab, you need to check if the runtime for it is set to use Python 3 and uses a GPU as hardware accelerator. You can check and eventually set it from the toolbar menu Runtime -> Change runtime type. Then you have to check that Colab has given you access to a NVIDIA Tesla GPU, as it is supported by Rapids. You can do this check from the notebook code by running

!nvidia-smi

and look for the GPU type, as highligthed in figure 2:

Fig. 2 - The output of the nvidia-smi command in a Colab notebook

The next step would be the installation of the cuDF library for CUDA 10.x. You can use pip from the notebook:

!pip install cudf-cuda100

At the end of the installation, before importing the cuDF package, you need to do an extra setup that I am going to explain below. If you don't do it, any time you try to execute the cuDF API, you will receive the following misleading error:

Fig. 3 - The error message in Colab when trying to use the cuDF API

The message states that the cudatoolkit isn't installed in your environment, so the numba package cannot be find, which isn't true, as cudatoolkit is already part of the Colab environment. The real root cause of this error is that the paths to the drivers are different in the runtime from what expected by the library. So you have to locate them first

dev_lib_path = !find / -iname 'libdevice'
nvvm_lib_path = !find / -iname 'libnvvm.so'


and setup the environment accordingly

import os

if len(dev_lib_path) > 0:
    os.environ['NUMBAPRO_LIBDEVICE'] = dev_lib_path[0]
else:
    print('The device lib is missing.')
if len(nvvm_lib_path) > 0:
    os.environ['NUMBAPRO_NVVM'] = nvvm_lib_path[0]
else:
    print('NVVM is missing.')


I have also put extra checks in case the paths shouldn't be found, which would probably be useless, but you never know :)

Now you can import cuDF, numpy and any other Python package you would need

import cudf
import numpy as np
...


and start playing with GPU Data Frames

df = cudf.DataFrame()
...


Enjoy it!

I will share my impressions on this library and the others in Rapids as soon as I have completed some PoCs.

giovedì 31 ottobre 2019

See you at the Data Science Meetup on November 6th!

Following my recent talk at day 2 of the Big Data Days in Moscow, it seems that the training on Apache Spark of Deep Learning models is a hot topic. If you are in Dublin on Wednesday November 6th and want to hear more about it, please join the next Data Science Ireland Meetup, which would be hosted by Mason, Hayes & Curran. The event will start at 6 PM, it will be moderated by Mark Kelly from Alldus and there will be talks from Brian McElligott, Partner at Mason Hayes & Curran and me. You can find all of the details in the official Meetup page.



At the moment this post is written the full capacity (120 places) has been reached and there is one person in the waiting list, but if you're interested in I suggest you to join any way the waiting list and monitor it, as some people could cancel also last minute. I hope to meet you there.

lunedì 21 ottobre 2019

See you tomorrow at the DSF Meetup!

If you are interested on hearing more about some way to do predictions of Apache Spark applications performance, please join tomorrow's Dublin Data Science Festival Meetup which would start at 6 PM  local time at the Walmart Labs place. Two talks in agenda, the first one from Mirko Arnold (Walmart Labs) about Computer Vision and the second one from me.
It would also be another great opportunity for networking.