Open-Source Frameworks for Deep Learning: an Overview
Vincenzo Lomonaco
University of Bologna ML Course - 2020
Post-Doc @ University of Bologna
President & Co-Founder of ContinualAI.org vincenzolomonaco.com
About Me
• Post-Doc @ University of Bologna
• Visiting Scholar @ ENSTA ParisTech, Purdue University and Numenta
• Teaching Assistant of the courses Machine Learning and Computer Architectures
• Author and Technical reviewer of the online course Deep Learning with R and book R Deep Learning Essentials
• Co-Founder & President of ContinualAI
• Co-Founder & Board Member of AIforPeople
https://www.vincenzolomonaco.com
Outline
1. Introduction
a. From Machine Learning to Deep Learning b. History of Deep Learning Frameworks
2. Open-Source Deep Learning Frameworks a. Main Features and Distinctions
b. Pytorch and Tensorflow 3. Practical Advices
4. What next?
What’s ContinualAI?
● ContinualAI is a non-profit research organization and the largest research community on Continual Learning for AI.
● It counts more than 1000+ members in 19 different time-zones and from top-notch research institutions.
● Learn more about ContinualAI at www.continualai.org
The Machine Learning Software Stack
“Hidden Technical Debt in Machine Learning Systems” by D. Sculley et al.
The Machine Learning Software Stack
For Prototyping and R&D
● Scikit-learn (Python), Caret (R), Weka (Java)
For Production
● Kubernetes, KubeFlow, Hadoop
● H2O, MLlib, SparkML, FlinkML
Setting up a Machine Learning Framework for Production: http://code.hootsuite.com/setting-up-a-machine-learning-framework-for-production/
From Machine Learning to Deep Learning
For Deep Learning the line between Prototyping and Production is more blurred
● Caffe / Caffe 2
● Torch / PyTorch
● Tensorflow
● CNTK, MxNet, Gluon, Chainer, etc.
From Machine Learning to Deep Learning
Why
● Prototyping with neural nets on massive datasets needs efficiency
● Limited focus on:
1. (Deep) Neural Networks.
2. Gradient-Based Optimization.
3. Transparent (multi) CPU/GPU acceleration
History of Deep Learning Frameworks
2010 2013 2014 2015 2016 2017 2018
...
Comparison of deep-learning software: https://en.wikipedia.org/wiki/Comparison_of_deep-learning_software
History of Deep Learning Frameworks
History of Deep Learning Frameworks
Andrej Karpathy, 10 mar 2018: https://twitter.com/karpathy/status/972295865187512320/
Deep Learning Frameworks: 2018 Figures
Deep Learning Framework Power Scores 2018: https://towardsdatascience.com/deep-learning-framework-power-scores-2018-23607ddf297a/
Deep Learning Frameworks: 2018 Figures
Deep Learning Framework Power Scores 2018: https://towardsdatascience.com/deep-learning-framework-power-scores-2018-23607ddf297a/
Is PyTorch Catching TensorFlow? 2020 Update
Is PyTorch Catching TensorFlow? https://towardsdatascience.com/is-pytorch-catching-tensorflow-ca88f9128304
Is PyTorch Catching TensorFlow? 2020 Update
Is PyTorch Catching TensorFlow? https://towardsdatascience.com/is-pytorch-catching-tensorflow-ca88f9128304
Outline
1. Introduction
a. From Machine Learning to Deep Learning b. History of Deep Learning Frameworks
2. Open-Source Deep Learning Frameworks a. Main Features and Distinctions
b. Tensorflow and Pytorch 3. Practical Advices
4. What next?
Main Features and Distinctions
1. Static vs Dynamic Graph 2. Differentiation Support
3. Hardware / Platform Support
4. Model / Utils Support and Performance 5. Multi-CPU/GPU support
6. API level
7. License and Community Support
Comparison of deep learning software: https://en.wikipedia.org/wiki/Comparison_of_deep_learning_software
Static vs Dynamic Graph
Static (define-AND-run) Dynamic (define-BY-run)
Differentiation Support
Types of Differentiation
1. Numerical Differentiation 2. Symbolic Differentiation 3. Automatic Differentiation 4. Hard-coded Differentiation
“Automatic Differentiation in Machine Learning: a Survey”: http://www.jmlr.org/papers/volume18/17-468/17-468.pdf
Hardware / Platform Support
Platform Support
● Windows, Unix (MAC OS, Linux)
● Android OS, iOS, Embedded Systems
Hardware Acceleration
● Cuda / OpenCL Support
● OpenMP, MPI Support
● AI Chips
Model / Utils Support and Performance
Types of models supported
● FC-NNs, CNNs, RNNs, etc.
● General purpose algebraic functions
Utils support
● Pre-trained models Zoo
● Data format and loading
● Monitoring / Visualization tools
Performance
● Very different from task to task and model to model, etc.
Multi-CPU / GPU support
Types of parallelization
● Data Parallelism
● Model Parallelism
Hardware for parallelization
● CPUs
● GPUs
● Distributed clusters
“Large Scale Distributed Deep Networks”: http://papers.nips.cc/paper/4687-large-scale-distributed-deep-networks.pdf
API Level
Important features
● Usability
● Flexibility
● Expandability
● Easy to Debug
License and Community Support
Licence
● Apache 2.0, MIT, BSD, GNU GPL, Freemium, etc.
● Most of them allow also commercial use (but look at patent licence too)
Community Support
● Contribution Diversity
● Active Development
● Supportive Q&A
● Number of users
Tensorflow and Pytorch
● Static/Dynamic Graph
● Automatic Differentiation
● Windows, Unix, Embedded
● General purpose graph
● Multi-CPU/GPUs
● C++ and (many) Python API
● Apache 2.0
● High community support
● Dynamic Graph
● Automatic Differentiation
● Windows, Unix, Embedded
● General purpose graph
● Multi-CPU/GPUs
● C++ and Python API
● BSD Licence
● High community support
Tensorflow: Deep learning framework by Google
“Tensorflow: a system for large-scale machine learning.”: https://www.usenix.org/system/files/conference/osdi16/osdi16-abadi.pdf
Tensorflow: Deep learning framework by
Tensorflow: Deep learning framework by Google
Key features
● Great models / utils support
● Large API variants at different levels
● Solid codebase
● Amazing community support and permissive Apache 2.0 licence
Tensorflow course: https://ekababisong.org/gcp-ml-seminar/tensorflow/
Pytorch: Deep learning framework by Facebook
“Automatic differentiation in PyTorch”: https://openreview.net/pdf?id=BJJsrmfCZ
Pytorch: Deep learning framework by
Pytorch: Deep learning framework by Facebook
Key features
● Great models / utils support
● Nice integration with ONNX and Caffe2
● Great for highly-dynamic graphs
● Simple, neat API
● Easy to learn
Python API C++ API
[Hands-on (30 minutes)] Training a
ConvNet with Pytorch
Outline
1. Introduction
a. From Machine Learning to Deep Learning b. History of Deep Learning Frameworks
2. Open-Source Deep Learning Frameworks a. Main Features and Distinctions
b. Tensorflow and Pytorch 3. Practical Advices
4. What next?
Practical Advices
Practical Advices
● Your don’t need to choose one framework for life
● Be flexible, understand the core and common ideas
● On-the-run conversion may be painful!
● Choose the best depending on the task at hand
and the already existing resources
What Next?
Questions?
Vincenzo Lomonaco
University of Bologna ML Course - 2020
Post-Doc @ University of Bologna
President & Co-Founder of ContinualAI.org vincenzolomonaco.com