TensorFrames: Spark + TensorFlow: Since the creation of Apache Spark, I/O throughput has increased at a faster pace than processing speed. In a lot of big data applications, the bottleneck is increasingly the CPU. With the release of Apache Spark 2.0 and Project Tungsten, Spark runs a number of control operations close to the metal. At the same time, there has been a surge of interest in using GPUs (the Graphics Processing Units of video cards) for general purpose applications, and a number of frameworks have been proposed to do numerical computations on GPUs.In this talk, we will discuss how to combine Apache Spark with TensorFlow, a new framework from Google that provides building blocks for Machine Learning computations on GPUs. Through a binding between Spark and TensorFlow called TensorFrames, distributed numerical transforms on Spark DataFrames and Datasets can be expressed in a high-level language and still rely on highly optimized implementations.The developers of the TensorFrames package will provide an overview, a live demo on Databricks and a presentation of the future plans. For experts, this talk will also include some technical details on design decisions, the current implementation, and ongoing work on speed and performance optimizations for numerical applications.
Deep Learning on Apache Spark: TensorFrames & Deep Learning Pipelines
1. Deep Learning avec Spark:
TensorFrames
Deep Learning Pipelines
Timothée Hunter
09 Novembre 2017
2. Bio
• Timothée (Tim) Hunter
• Ingénieur (Machine Learning) à Databricks
• X04, M.S. Stanford
• Ph.D. de UC Berkeley en Machine Learning
• Ancien utilisateur (No 2) de Spark
• Contributions à MLlib
• Co-créateur des packages TensorFrames, GraphFrames, Deep
Learning Pipelines
#EUds6 2
3. L’équipe
Le produit
À propos de Databricks
La mission
Regroupe les créateurs de Spark (maintenant Apache Spark), lancé à
UC Berkeley en 2009
33
Une platforme unifiée pour l’analyse des
données
Unified Analytics Platform
Simplifier le Big Data
Making Big Data Simple
Essayez gratuitement:
databricks.com
4. Cette présentation
• Spark et Deep Learning: l’état des lieux
• TensorFrames: intégration haute performance avec TensorFlow
• Deep Learning Pipelines (DLP): le Deep Learning, avec simplicité
5. Deep Learning? Apprentissage en
profondeur?
• Un ensemble de techniques qui représente des transformations
par couches successives
• Applicable en classification, regression, etc.
• Populaire dans les années 80 (réseaux de neurones)
• De nouveau utilisés (nouveaux algorithmes d’apprentissage,
large collections de données, meilleures machines)
t
6. Spark et le Deep Learning
• Spark n’inclut pas de bibliothèque de Deep Learning
• Les bibliothèques existantes souvent difficiles à utiliser ou lentes
• TensorFrames: intégration bas niveau, haute performance
• Deep Learning Pipelines: faciliter le Deep Learning, avec Spark
9. • Graphics Processing Units for General Purpose computations
GPGPUs
9
4.6
Theoretical peak
throughput
(Tflops, single precision)
GPU CPU
Theoretical peak
bandwidth
(GB/s)
GPU CPU
10. • Bibliothèque dédiée au “machine intelligence”
• Très populaire pour le Deep Learning
• Mais aussi excellente pour les calculs numériques
• Interface: C++ et Python (et d’autres langages)
Google TensorFlow
10
11. Dataflow numérique avec Tensorflow
11
x = tf.placeholder(tf.int32, name=“x”)
y = tf.placeholder(tf.int32, name=“y”)
output = tf.add(x, 3 * y, name=“z”)
session = tf.Session()
output_value = session.run(output,
{x: 3, y: 5})
x:
int32
y:
int32
mul 3
z
12. Dataflow numérique avec Tensorflow
df = sqlContext.createDataFrame(…)
x = tf.placeholder(tf.int32, name=“x”)
y = tf.placeholder(tf.int32, name=“y”)
output = tf.add(x, 3 * y, name=“z”)
output_df = tfs.map_rows(output, df)
output_df.collect()
df: DataFrame[x: int, y: int]
output_df:
DataFrame[x: int, y: int, z: int]
x:
int32
y:
int32
mul 3
z
13. C’est un problème de communication
13
Spark worker process Worker python process
C++
buffer
Python
pickle
Tungsten
binary
format
Python
pickle
Java
object
20. Speedup
23
0
50
100
Scala UDF Scala UDF
(optimized)
TensorFrames TensorFrames
+ GPU
Normalized cost
def cost_fun(block, bandwidth):
distances = - square(constant(X) - sample) / (2 * b * b)
m = reduce_max(distances, 0)
x = log(reduce_sum(exp(distances - m), 0))
return identity(x + m - log(b * N), name="score”)
with device("/gpu"):
sample = tfs.block(df, "sample")
score = cost_fun(sample, bandwidth=0.5)
df.agg(sum(tfs.map_blocks(score, df))).collect()
21. Récapitulons
• Spark: excellent pour distribuer des calculs sur des centaines de
machines
• TensorFlow: excellent pour les calculs numériques
• Le meilleur des deux mondes avec TensorFrames
23. Deep Learning Pipelines: le Deep Learning
avec simplicité
Deep Learning Pipelines
• Libre (Apache 2.0), développée par Databricks
• Met l’accent sur la facilité and l’intégration
• sans oublier la performance
• Langage par défaut: Python
• Apache Spark utilisé pour distribuer les tâches
• S’intègre dans MLlib (Pipelines) pour faciliter les workflows ML
s