Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 Tutorial)
•
0 likes•226 views
This document summarizes a CVPR 2020 tutorial on the Analytics Zoo platform for automated machine learning workflows for distributed big data using Apache Spark. The tutorial covers an overview of Analytics Zoo and the BigDL distributed deep learning framework. It demonstrates distributed training of deep learning models using TensorFlow and PyTorch on Spark, and features of Analytics Zoo like end-to-end pipelines, ML workflow for automation, and model deployment with cluster serving. Real-world use cases applying Analytics Zoo at companies like SK Telecom, Midea, and MasterCard are also presented.
1 of 38
Download to read offline
More Related Content
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 Tutorial)
3. CVPR 2020 Tutorial
Distributed, High-Performance
Deep Learning Framework
for Apache Spark
https://github.com/intel-analytics/bigdl
Unified Analytics + AI Platform
for TensorFlow, PyTorch, Keras, BigDL,
Ray and Apache Spark
https://github.com/intel-analytics/analytics-zoo
AI on BigData
5. CVPR 2020 Tutorial
BigDL
Distributed deep learning framework for Apache Spark
https://github.com/intel-analytics/BigDL
• Write deep learning applications as
standard Spark programs
• Run on existing Spark/Hadoop clusters
(no changes needed)
• Scalable and high performance
• Optimized for large-scale big data clusters
Spark Core
SQL SparkR Streaming
MLlib GraphX
ML Pipeline
DataFrame
“BigDL: A Distributed Deep Learning Framework for Big Data”, ACM Symposium of Cloud Computing
conference (SoCC) 2019, https://arxiv.org/abs/1804.05839
6. CVPR 2020 Tutorial
Analytics Zoo
Unified Data Analytics and AI Platform
End-to-End Pipelines
(Automatically scale AI models to distributed Big Data)
ML Workflow
(Automate tasks for building end-to-end pipelines)
Models
(Built-in models and algorithms)
K8s Cluster CloudLaptop Hadoop Cluster
7. CVPR 2020 Tutorial
Analytics Zoo
Recommendation
Distributed TensorFlow & PyTorch on Spark
Spark Dataframes & ML Pipelines for DL
RayOnSpark
InferenceModel
Models &
Algorithms
End-to-end
Pipelines
Time Series Computer Vision NLP
Unified Data Analytics and AI Platform
https://github.com/intel-analytics/analytics-zoo
ML Workflow AutoML Automatic Cluster Serving
Compute
Environment
K8s Cluster Cloud
Python Libraries
(Numpy/Pandas/sklearn/…)
DL Frameworks
(TF/PyTorch/OpenVINO/…)
Distributed Analytics
(Spark/Flink/Ray/…)
Laptop Hadoop Cluster
Powered by oneAPI
8. CVPR 2020 Tutorial
Integrated Big Data Analytics and AI
Production
Data pipeline
Prototype on laptop
using sample data
Experiment on clusters
with history data
Production deployment w/
distributed data pipeline
• Easily prototype end-to-end pipelines that apply AI models to big data
• “Zero” code change from laptop to distributed cluster
• Seamlessly deployed on production Hadoop/K8s clusters
• Automate the process of applying machine learning to big data
Seamless Scaling from Laptop to Distributed Big Data
12. CVPR 2020 Tutorial
Distributed TensorFlow/PyTorch on Spark in
Analytics Zoo
#pyspark code
train_rdd = spark.hadoopFile(…).map(…)
dataset = TFDataset.from_rdd(train_rdd,…)
#tensorflow code
import tensorflow as tf
slim = tf.contrib.slim
images, labels = dataset.tensors
with slim.arg_scope(lenet.lenet_arg_scope()):
logits, end_points = lenet.lenet(images, …)
loss = tf.reduce_mean(
tf.losses.sparse_softmax_cross_entropy(
logits=logits, labels=labels))
#distributed training on Spark
optimizer = TFOptimizer.from_loss(loss, Adam(…))
optimizer.optimize(end_trigger=MaxEpoch(5))
Write TensorFlow/PyTorch
inline with Spark code
Analytics Zoo API in blue
13. CVPR 2020 Tutorial
Image Segmentation using TFPark
https://github.com/intel-analytics/zoo-
tutorials/blob/master/tensorflow/notebooks/image_segmentation.ipynb
14. CVPR 2020 Tutorial
Face Generation Using Distributed PyTorch on
Analytics Zoo
https://github.com/intel-analytics/analytics-
zoo/blob/master/apps/pytorch/face_generation.ipynb
15. CVPR 2020 Tutorial
Spark Dataframe & ML Pipeline for DL
#Spark dataframe code
parquetfile = spark.read.parquet(…)
train_df = parquetfile.withColumn(…)
#Keras API
model = Sequential()
.add(Convolution2D(32, 3, 3))
.add(MaxPooling2D(pool_size=(2, 2)))
.add(Flatten()).add(Dense(10)))
#Spark ML pipeline code
estimater = NNEstimater(model,
CrossEntropyCriterion())
.setMaxEpoch(5)
.setFeaturesCol("image")
nnModel = estimater.fit(train_df)
Analytics Zoo API in blue
16. CVPR 2020 Tutorial
Image Similarity using NNFrame
https://github.com/intel-analytics/analytics-zoo/blob/master/apps/image-
similarity/image-similarity.ipynb
17. CVPR 2020 Tutorial
RayOnSpark
Run Ray programs directly on YARN/Spark/K8s cluster
“RayOnSpark: Running Emerging AI Applications on Big Data Clusters with Ray and Analytics Zoo”
https://medium.com/riselab/rayonspark-running-emerging-ai-applications-on-big-data-clusters-
with-ray-and-analytics-zoo-923e0136ed6a
Analytics Zoo API in blue
sc = init_spark_on_yarn(...)
ray_ctx = RayContext(sc=sc, ...)
ray_ctx.init()
#Ray code
@ray.remote
class TestRay():
def hostname(self):
import socket
return socket.gethostname()
actors = [TestRay.remote() for i in range(0, 100)]
print([ray.get(actor.hostname.remote())
for actor in actors])
ray_ctx.stop()
18. CVPR 2020 Tutorial
Sharded Parameter Server With RayOnSpark
https://github.com/intel-analytics/analytics-zoo/blob/master/apps/image-similarity/image-
similarity.ipynb
20. CVPR 2020 Tutorial
Distributed Inference Made Easy with Cluster Serving
P5
P4
P3
P2
P1
R4
R3
R2
R1R5
Input Queue for requests
Output Queue (or files/DB tables)
for prediction results
Local node or
Docker container Hadoop/Yarn/K8s cluster
Network
connection
Model
Simple
Python script
https://software.intel.com/en
-us/articles/distributed-
inference-made-easy-with-
analytics-zoo-cluster-serving#enqueue request
input = InputQueue()
img = cv2.imread(path)
img = cv2.resize(img, (224, 224))
input.enqueue_image(id, img)
#dequeue response
output = OutputQueue()
result = output.dequeue()
for k in result.keys():
print(k + “: “ +
json.loads(result[k]))
√ Users freed from complex distributed inference solutions
√ Distributed, real-time inference automatically managed by Analytics Zoo
− TensorFlow, PyTorch, Caffe, BigDL, OpenVINO, …
− Spark Streaming, Flink, …
Analytics Zoo API in blue
21. CVPR 2020 Tutorial
Scalable AutoML for Time Series Prediction
“Scalable AutoML for Time Series Prediction using Ray and Analytics Zoo”
https://medium.com/riselab/scalable-automl-for-time-series-prediction-
using-ray-and-analytics-zoo-b79a6fd08139
Automated feature selection, model selection and hyper parameter tuning using Ray
tsp = TimeSequencePredictor(
dt_col="datetime",
target_col="value")
pipeline = tsp.fit(train_df,
val_df, metric="mse",
recipe=RandomRecipe())
pipeline.predict(test_df)
Analytics Zoo API in blue
22. CVPR 2020 Tutorial
FeatureTransformer
Model
SearchEngine
Search presets
Workflow implemented in TimeSequencePredictor
trial
trial
trial
trial
…best model
/parameters
trail jobs
Pipeline
with tunable parameters
with tunable parameters
configured with best parameters/model
Each trial runs a different combination of
hyper parameters
Ray Tune
rolling, scaling, feature generation, etc.
Spark + Ray
AutoML Training
25. CVPR 2020 Tutorial
Project Zouwu: Time Series for Telco
Project Zouwu
• Use case - reference time series use cases for
Telco (such as network traffic forecasting, etc.)
• Models - built-in models for time series analysis
(such as LSTM, MTNet, DeepGlo)
• AutoTS - AutoML support for building E2E time
series analysis pipelines
(including automatic feature generation, model
selection and hyperparameter tuning)
Project
Zouwu
Built-in Models
ML Workflow AutoML Workflow
Integrated Analytics & AI Pipelines
use-case
models autots
*Joint-collaborations with NPG
https://github.com/intel-analytics/analytics-
zoo/tree/master/pyzoo/zoo/zouwu
27. CVPR 2020 Tutorial
Project Orca: Easily Scaling Python AI pipeline
on Analytics Zoo
Seamless scale Python notebook from laptop
to distributed big data
• orca.data: data-parallel pre-processing for
(any) Python libs
• pandas, numpy, sklearn, PIL, spacy, tensorflow Dataset,
pytorch dataloader, spark, etc.
• orca.learn: transparently distributed training
for deep learning
• sklearn style estimator for TensorFlow, PyTorch, Keras,
Horovod, MXNet, etc.
https://github.com/intel-analytics/analytics-
zoo/tree/master/pyzoo/zoo/orca
29. CVPR 2020 Tutorial
Migrating from GPU in SK Telecom
Time Series Based Network Quality Prediction
https://webinar.intel.com/AI_Monitoring_WebinarREG
Data Loader
DRAM
Store
tiering forked.
Flash
Store
customized.
Data Source APIs
Spark-SQL
Preproce
ss
SQL Queries
(Web, Jupyter) LegacyDesignwithGPU
Export Preprocessing AITraining/Inference
GPU
Servers
ReduceAIInferencelatency ScalableAITraining
NewArchitecture: Unified DataAnalytic+AIPlatform
Preprocessing RDDofTensor AIModelCodeofTF
2nd Generation Intel® Xeon®
Scalable Processors
30. CVPR 2020 Tutorial
Migrating from GPU in SK Telecom
Time Series Based Network Quality Prediction
Python Distributed
Preprocessing
(DASK) & Inference
on GPU
Intel
Analytics Zoo
1 Server
Xeon 6240
Intel
Analytics Zoo
3 Servers
Xeon 6240
Python
Preprocessing
(Pandas) &
Inference on GPU
74.26 10.24 3.24 1.61
3X 6X
Test Data: 80K Cell Tower, 8 days, 5mins period, 8 Quality Indicator
TCOoptimizedAIperformance with [ 1 ] AnalyticsZoo [ 2 ] IntelOptimizedTensorflow [ 3 ] DistributedAIProcessing
[ 1 ] Pre-processing& InferenceLatency
Seconds 0
200
400
600
800
1000
1200
1400
1600
1800
BS 4,096 BS 8,192 BS 16,384 BS 32,768 BS 65,536
Intel Analytics Zoo -
1 Server ( Xeon 6240)
GPU
Intel Analytics Zoo - 3 Servers
Distributed Training - Scalability case (Xeon 6240)
[ 2 ] Time-To-TrainingPerformance
Performance test validation @ SK Telecom Testbedhttps://webinar.intel.com/AI_Monitoring_WebinarREG
For more complete information about performance and benchmark results, visit www.intel.com/benchmarks.
31. CVPR 2020 Tutorial
Edge to Cloud Architecture in Midea
Computer Vision Based Product Defect Detection
https://software.intel.com/en-us/articles/industrial-inspection-platform-in-midea-and-kuka-using-distributed-tensorflow-on-analytics
32. CVPR 2020 Tutorial
Product Recommendation on AWS in Office Depot
https://software.intel.com/en-
us/articles/real-time-product-
recommendations-for-office-depot-
using-apache-spark-and-analytics-
zoo-on
33. CVPR 2020 Tutorial
Recommender Service on Cloudera in MasterCard
https://software.intel.com/en-us/articles/deep-learning-with-analytic-zoo-optimizes-mastercard-recommender-ai-service
Train NCF Model
Features Models
Model
Candidates
Models
sampled
partition
Training Data
…
Load Parquet
Train Multiple Models
Train Wide & Deep Model
sampled
partition
sampled
partition
Spark ML Pipeline Stages
Test Data
Predictions
Test
Spark DataFramesParquet Files
Feature
Selections
SparkMLPipeline
Neural Recommender using Spark
and Analytics Zoo
Estimator
Transformer
Model
Evaluation
& Fine Tune
Train ALS Model
34. CVPR 2020 Tutorial
NLP Based Customer Service Chatbot for Microsoft Azure
https://software.intel.com/en-us/articles/use-analytics-zoo-to-inject-ai-into-customer-service-platforms-on-microsoft-azure-part-1
https://www.infoq.com/articles/analytics-zoo-qa-module/
35. CVPR 2020 Tutorial
Technology EndUsersCloudServiceProviders
*Other names and brands may be claimed as the property of others.
software.intel.com/data-analytics
Not a full list
And Many More