基于Java的开源深度学习框架-
Deeplearning4j的介绍与实例分享
分享人:万宫玺
Outline
• Deeplearning4j Intro
• Deeplearning4j Eco-system
• Deeplearning4j
• ND4j
• DataVec
• Deeplearning4j Modeling
• Single
• Parallel
• Distributed with Spark
• Example: Develop & Deploy
• Transfer Learning & Reinforcement Learning in Deeplearning4j
• Summary
• About AI
Deeplearning4j Intro
• Deeplearning4j是由AI创业公司Skymind(skymind.ai/)主导开发并维护的
基于Java/JVM的深度学习开源框架。包括腾讯、SVAngel、
GreatPointVentures等都参与了对这家公司的投资。NASA喷气实验室、
IBM、雪弗兰、埃森哲等企业都是其用户。
• Deeplearning4j最新版本:0.9.2/1.0.0
• Deeplearning4j支持CPU/GPU集群分布式大规模深度学习模型的训练
• Deeplearning4j是为数不多原生态支持Apache Spark的深度学习开源框
架
• Deeplearning4j于2017.10月进入Eclipse社区
• 官网:deeplearning4j.org/
• github地址:github.com/deeplearning4j
Deeplearning4j Eco-system
• Deep Learning for Java/JVM(dl4j)
• N-Dimensional Arrays for Java/JVM(nd4j/libnd4j)
• Data ETL Library for Machine/Deep Learning(datavec)
• Deep Reinforcement Learning for Java/JVM(rl4j)
• Hyperparameter Tuning(arbiter)
• Examples(dl4j-examples)
• Model Zoo(dl4j-model-zoo)
• Others(nd4s/scalnet/dl4j-benchmark …)
Deeplearning4j Eco-system
--dl4j Module
• deeplearning4j(github.com/deeplearning4j/deeplearning4j)中定
义并实现了常用的神经网络结构、优化算法以及一些tuning trick
• 实现了并行与分布式训练
• 支持导入Keras的模型
• Embedding的相关实现(Word2Vec/Glov2Vec)
• 训练过程的可视化页面(Loss Score/Gradient Value,>JDK1.8)
• Model Zoo(AlexNet/GoogLenet/DeepFace/YOLO,>v0.9.0)
常见网络结构的实现
Word2Vec/Glov2Vec
数据并行化
训练过程可视化
GPU相关
导入Keras
常见模型
Deeplearning4j Eco-system
--nd4j module
• ND4j可当作是Java版的Numpy,定义了各种张量运算
• ND4j的后台可在BLAS的开源库中切换
Deeplerning4j Eco-system
--nd4j memory management
• ND4j利用堆外内存(off-heap memory)来存储张量对象
• ND4j中的堆上内存(on-heap memory)存储张量对象的引用/指针
• ND4j中实际的张量运算后台时BLAS的开源实现,将张量对象作为堆
外内存存储,可加快运行效率
• 堆上内存:-Xms -Xmx
• 堆外内存: -Dorg.bytedeco.javacpp.maxbytes
-Dorg.bytedeco.javacpp.maxphysicalbytes
• Spark on Yarn Executor内存调优: --executor-memory调整堆上内存
--conf “spark.executor.extraJavaOptions”
--conf “spark.yarn.executor.memoryOverhead”调整堆外内存
Deeplearning4j Eco-system
--nd4j example