114 lines
7.0 KiB
Markdown
114 lines
7.0 KiB
Markdown
<!-- WEHUB_ZH_README -->
|
||
> [!NOTE]
|
||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||
> [English](./README.en.md) · [原始项目](https://github.com/deeplearning4j/deeplearning4j) · [上游 README](https://github.com/deeplearning4j/deeplearning4j/blob/HEAD/README.md)
|
||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||
|
||
<p align="center">
|
||
<img src="https://www.zeljkoobrenovic.com/tools/tech/images/eclipse_deeplearning4j.png">
|
||
</p>
|
||
|
||
[](https://deeplearning4j.konduit.ai/)
|
||
[](https://community.konduit.ai/)
|
||
[](https://javadoc.io/doc/org.deeplearning4j/deeplearning4j-nn)
|
||
[](https://javadoc.io/doc/org.nd4j/nd4j-api)
|
||
[](LICENSE)
|
||

|
||
|
||
|
||
**[Eclipse Deeplearning4J](https://deeplearning4j.konduit.ai/)** (DL4J) 生态系统是一组项目,旨在满足基于 JVM 的深度学习应用的全部需求。这意味着从原始数据出发,无论数据位于何处、以何种格式存在,都能完成加载与预处理,进而构建并调优各种简单与复杂的深度学习网络。
|
||
|
||
由于 Deeplearning4J 运行在 JVM 上,除 Java 外,你还可以将其与多种基于 JVM 的语言配合使用,例如 Scala、Kotlin、Clojure 等。
|
||
|
||
DL4J 技术栈包括:
|
||
- **DL4J**:用于构建 MultiLayerNetworks 和 ComputationGraphs 的高级 API,提供多种层(包括自定义层)。支持从 h5 导入 Keras 模型(自 1.0.0-beta7 起包括 tf.keras 模型),并支持在 Apache Spark 上进行分布式训练
|
||
- **ND4J**:通用线性代数库,包含 500 多种数学、线性代数与深度学习运算。ND4J 基于高度优化的 C++ 代码库 LibND4J,通过 OpenBLAS、OneDNN(MKL-DNN)、cuDNN、cuBLAS 等库提供 CPU(AVX2/512)与 GPU(CUDA)支持与加速
|
||
- **SameDiff**:ND4J 库的一部分,SameDiff 是我们的自动微分 / 深度学习框架。SameDiff 采用基于图的“先定义后运行”(define then run)方式,类似于 TensorFlow 的图模式(graph mode)。急切图(eager graph,类似 TensorFlow 2.x eager/PyTorch)执行已在规划中。SameDiff 支持导入 TensorFlow 冻结模型格式 .pb(protobuf)模型。对 ONNX、TensorFlow SavedModel 和 Keras 模型的导入也在规划中。Deeplearning4j 还提供完整的 SameDiff 支持,便于编写自定义层与损失函数。
|
||
- **DataVec**:面向机器学习数据的 ETL,支持多种格式与文件(HDFS、Spark、图像、视频、音频、CSV、Excel 等)
|
||
- **LibND4J**:支撑一切的 C++ 库。有关 JVM 如何访问原生数组与运算的更多信息,请参阅 [JavaCPP](https://github.com/bytedeco/javacpp)
|
||
- **Python4J**:为 JVM 捆绑的 cpython 执行环境
|
||
|
||
DL4J 生态系统中的所有项目均支持 Windows、Linux 和 macOS。硬件支持包括 CUDA GPU(10.0、10.1、10.2,OSX 除外)、x86 CPU(x86_64、avx2、avx512)、ARM CPU(arm、arm64、armhf)以及 PowerPC(ppc64le)。
|
||
|
||
## 社区支持
|
||
如需获取项目支持,请前往 https://community.konduit.ai/
|
||
|
||
## 在项目中使用 Eclipse Deeplearning4J
|
||
|
||
Deeplearning4J 依赖项较多。因此,我们仅支持通过构建工具使用。
|
||
|
||
```xml
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>org.eclipse.deeplearning4j</groupId>
|
||
<artifactId>deeplearning4j-core</artifactId>
|
||
<version>1.0.0-M2.1</version>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.eclipse.deeplearning4j</groupId>
|
||
<artifactId>nd4j-native-platform</artifactId>
|
||
<version>1.0.0-M2.1</version>
|
||
</dependency>
|
||
</dependencies>
|
||
```
|
||
|
||
将上述依赖添加到你的 pom.xml 文件中,即可使用 CPU 后端的 Deeplearning4J。若要从零开始新建 Maven 项目,[示例仓库中提供了完整的独立项目示例](https://github.com/eclipse/deeplearning4j-examples),
|
||
|
||
## 代码示例
|
||
|
||
由于 DL4J 是一个多面性的单体仓库(mono repo)项目,包含多个模块,我们建议查看示例以了解各模块的不同用法。下面我们将链接到各模块的示例。
|
||
|
||
1. ND4J: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/nd4j-ndarray-examples
|
||
2. DL4J: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/dl4j-examples
|
||
3. Samediff: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/samediff-examples
|
||
4. Datavec: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/data-pipeline-examples
|
||
5. Python4j: https://deeplearning4j.konduit.ai/python4j/tutorials/quickstart
|
||
|
||
|
||
对于希望运行其他框架模型的用户,请参阅:
|
||
1. Onnx: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/onnx-import-examples
|
||
2. Tensorflow/Keras: https://github.com/deeplearning4j/deeplearning4j-examples/tree/master/tensorflow-keras-import-examples
|
||
|
||
|
||
## 文档、指南与教程
|
||
你可以在 http://deeplearning4j.konduit.ai/. 找到 Deeplearning4J 及其生态系统其他库的官方文档
|
||
|
||
## 想要一些示例?
|
||
我们有一个单独的仓库,提供各类示例:https://github.com/eclipse/deeplearning4j-examples
|
||
|
||
## 从源码构建
|
||
建议优先使用官方预编译发行版(见上文)。但若你想从源码构建,请先查看此处的从源码构建先决条件:https://deeplearning4j.konduit.ai/multi-project/how-to-guides/build-from-source. 其中包含 CPU 与 GPU 构建的各类说明。如需进一步帮助,请前往我们的[论坛](https://community.konduit.ai/)
|
||
|
||
|
||
## 运行测试
|
||
|
||
要运行测试,请参阅 platform-tests 模块。
|
||
该模块仅在 jdk 11 上运行(主要由于 spark 以及旧版 scala 与 JDK 17 的兼容问题)。
|
||
|
||
platform-tests 允许你针对不同后端运行 dl4j。
|
||
你可以在命令行上指定以下几个属性:
|
||
1. backend.artifactId:默认为 nd4j-native,将在 CPU 上运行测试;你也可以指定其他后端,例如 nd4j-cuda-11.6
|
||
2. dl4j.version:可更改测试所针对的 dl4j 版本。默认为 1.0.0-SNAPSHOT。
|
||
|
||
更多参数可在此处找到:
|
||
https://github.com/deeplearning4j/deeplearning4j/blob/c1bf8717e4839c8930e9c43183bf7b94d0cf84dc/platform-tests/pom.xml#L47
|
||
|
||
|
||
|
||
|
||
|
||
## 在 IntelliJ IDEA 中运行项目:
|
||
1. 请确保在 jdk 9 或更高版本上遵循 https://stackoverflow.com/questions/45370178/exporting-a-package-from-system-module-is-not-allowed-with-release
|
||
2. 忽略所有 nd4j-shade 子模块。右键点击每个文件夹,选择:Maven -> Ignore project
|
||
|
||
|
||
## 许可证
|
||
|
||
[Apache License 2.0](LICENSE)
|
||
|
||
|
||
## 商业支持
|
||
Deeplearning4J 由 [Konduit K.K.](https://konduit.ai). 团队积极开发。
|
||
|
||
[如需任何商业支持,欢迎通过 [support@konduit.ai](mailto:support@konduit.ai) 与我们联系。
|