Tensor in the Sky with CloudML
Tensor in the Sky with CloudML
1
@DataXDay
Sylvain Lequeux
@slequeux
2
@DataXDay
WHY ?
Deep Learning
3
@DataXDay
Classic Machine Learning
Question Feature Extraction Algorithm Response
4
@DataXDay
Deep Learning
Question Algorithm Response
Feature Extraction
5
@DataXDay
Neural Networks
6
@DataXDay
Artificial Neural Networks
X
7
@DataXDay
Artificial Neural Networks
8
@DataXDay
WHY ?
Cloud
9
@DataXDay
From IaaS to SaaS
Infrastructure
as
a
Service
Platform
as
a
Service
Software
as
a
Service
10
@DataXDay
Google CloudML
SaaS
Train
Predict
11
@DataXDay
CloudML
Cloud Storage
Compute
Training Job
Model 1
Version 1
Version 2
Compute VM
Folder
version 1
Folder
version 2
Google CloudML
12
@DataXDay
WHY ?
Use Case
13
@DataXDay
14
15
@DataXDay
Local Mode
At least, it’ll work
16
@DataXDay
17
Built-in models
There are pre-trained models
▼ Saves time for training
Param count approximation
▼ InceptionV3 : 23M
▼ VGG16 : 138M
Included into Tensorflow & Keras
Adapted architecture
▼ Conflutional
▼ MaxPooling
▼ Reccurrent
▼ ...
@DataXDay
18
@DataXDay
Export model
Or How to Reuse
Weight stored in-memory
▼ Need to retrain each time you start
▼ Non-deterministic behaviour
Use Protobuf format to store model
▼ Google’s data exchange format
▼ Stores weights and architecture
Model Directory
saved_model.pb
variables directory
19
@DataXDay
Export model
Prediction
Base 64
encode
[[[ 1.0, 1.2, 1.3 ], ...
data:image/j
peg;base64,/
9j/4AAQSkZ
JRgABA...
20
@DataXDay
21
@DataXDay
Serving In the Cloud
No diamonds, sorry
22
@DataXDay
Serving
Prediction
Base 64
encode
[[[ 1.0, 1.2, 1.3 ], ...
data:image/j
peg;base64,/
9j/4AAQSkZ
JRgABA...
23
@DataXDay
24
@DataXDay
Google functions
Proxify HTTP requests
Perform controls :
▼ Authentication
▼ Bandwidth controls
▼ …
Transform data
▼ Input preprocessing
▼ Output formatting
Google functions
A/B test your models
Implements A/B testing logic inside this function
25
@DataXDay
Learning In the Cloud
How about Magritte ?
26
@DataXDay
27
@DataXDay
Transfer learning [...] is a research
problem in machine learning that
focuses on storing knowledge gained
while solving one problem and applying
it to a different but related problem.
28
@DataXDay
Transfer learning
Retraining without retraining
First layers learn basic features
▼ Lines
▼ Colors
▼ ...
End layers learn complex features
▼ Objects
▼ Complex shapes
▼ …
Transfer learning is 2-steps :
▼ Freeze first layers
▼ Train new end layers
Layer 1
Layer 2
Layer N Layer N’
29
@DataXDay
Online training
Infinite power
▼ Define a setup.py file
▼ Define a config.yml file
▽ This could be done directly in step 3 by
passing args
▽ Defines CPU/GPU/TPU usage
▽ Defines runtime version
▽ ...
▼ Run it
▽ Using gcloud command line
▽ Use -- to separate gcloud args from your
job’s args
30
@DataXDay
31
@DataXDay
So, what ?
Conclusions : 2 for 1
32
@DataXDay
33
@DataXDay
34
@DataXDay
35
@DataXDay
36
@DataXDay
Thank you
https://github.com/slequeux/xke-cloudml
37
@DataXDay
38

DataXDay - Tensors in the sky with CloudML