From af10e2be4a2d608d65dae734489a2633b4eb1573 Mon Sep 17 00:00:00 2001 From: liuxiao78 Date: Mon, 10 Aug 2020 11:01:26 +0800 Subject: [PATCH 1/4] fix on_device_inference --- .../advanced_use/on_device_inference.md | 25 ++++++++++++++++--- .../advanced_use/on_device_inference.md | 25 ++++++++++++++++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/tutorials/source_en/advanced_use/on_device_inference.md b/tutorials/source_en/advanced_use/on_device_inference.md index 03d1fd6763..8fe3b1a608 100644 --- a/tutorials/source_en/advanced_use/on_device_inference.md +++ b/tutorials/source_en/advanced_use/on_device_inference.md @@ -47,9 +47,7 @@ The environment requirements are as follows: - [cmake](https://cmake.org/download/) >= 3.14.1 - [GCC](https://gcc.gnu.org/releases.html) >= 5.4 - [Android_NDK r20b](https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip) - - > The stallation of `Android_NDK` is needed only when using arm. This time we choose to use x86, so you can skip this step. - + Using MindSpore Lite converter tool needs to add more dependencies: - [autoconf](http://ftp.gnu.org/gnu/autoconf/) >= 2.69 - [libtool](https://www.gnu.org/software/libtool/) >= 2.4.6 @@ -69,8 +67,27 @@ The compilation procedure is as follows: 2. Run the following command in the root directory of the source code to compile MindSpore Lite. + - Compile converter tool:: + + ```bash + bash build.sh -I x86_64 + ``` + + - Compile inference platform: + + Set path of ANDROID_NDK: + ```bash + export ANDROID_NDK={$NDK_PATH}/android-ndk-r20b + ``` + + According to the phone,you can choose`arm64`: + ```bash + bash build.sh -I arm64 + ``` + + or`arm32`: ```bash - bash build.sh -I x86_64 + bash build.sh -I arm32 ``` 3. Go to the `mindspore/output` directory of the source code to obtain the compilation result. Unzip `MSLite-0.6.0-linux_x86_64.tar.gz` to get the result after building. diff --git a/tutorials/source_zh_cn/advanced_use/on_device_inference.md b/tutorials/source_zh_cn/advanced_use/on_device_inference.md index bdb2011521..2c8d168540 100644 --- a/tutorials/source_zh_cn/advanced_use/on_device_inference.md +++ b/tutorials/source_zh_cn/advanced_use/on_device_inference.md @@ -47,8 +47,6 @@ MindSpore Lite的框架主要由Frontend、IR、Backend、Lite RT、Micro构成 - [cmake](https://cmake.org/download/) >= 3.14.1 - [GCC](https://gcc.gnu.org/releases.html) >= 5.4 - [Android_NDK r20b](https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip) - - > 仅在使用arm架构时需要安装`Android_NDK`,本示例采用x86,可跳过此项。 使用MindSpore Lite转换工具,需要添加更多的依赖项: - [autoconf](http://ftp.gnu.org/gnu/autoconf/) >= 2.69 @@ -67,9 +65,28 @@ MindSpore Lite的框架主要由Frontend、IR、Backend、Lite RT、Micro构成 ``` 2. 在源码根目录下,执行如下命令编译MindSpore Lite。 - + + - 编译转换工具: + + ```bash + bash build.sh -I x86_64 + ``` + + - 编译推理框架: + + 设定ANDROID_NDK路径: + ```bash + export ANDROID_NDK={$NDK_PATH}/android-ndk-r20b + ``` + + 用户需根据设备情况,可选择`arm64`: + ```bash + bash build.sh -I arm64 + ``` + + 或`arm32`: ```bash - bash build.sh -I x86_64 + bash build.sh -I arm32 ``` 3. 进入源码的`mindspore/output`目录,获取编译结果`MSLite-0.6.0-linux_x86_64.tar.gz`。执行解压缩命令,获得编译后的工具包: -- Gitee From d82df901850be1b83a4ca88f0adccaef784e2680 Mon Sep 17 00:00:00 2001 From: JunYuLiu Date: Fri, 7 Aug 2020 17:12:38 +0800 Subject: [PATCH 2/4] fix links --- .../source_en/advanced_use/checkpoint_for_hybrid_parallel.md | 2 +- tutorials/source_en/advanced_use/host_device_training.md | 2 +- tutorials/source_en/advanced_use/mixed_precision.md | 2 +- tutorials/source_en/advanced_use/quantization_aware.md | 4 ++-- .../advanced_use/checkpoint_for_hybrid_parallel.md | 2 +- tutorials/source_zh_cn/advanced_use/host_device_training.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tutorials/source_en/advanced_use/checkpoint_for_hybrid_parallel.md b/tutorials/source_en/advanced_use/checkpoint_for_hybrid_parallel.md index 51cdb37a80..d9bd74fdc4 100644 --- a/tutorials/source_en/advanced_use/checkpoint_for_hybrid_parallel.md +++ b/tutorials/source_en/advanced_use/checkpoint_for_hybrid_parallel.md @@ -313,7 +313,7 @@ User process: 3. Execute stage 2 training: There are two devices in stage 2 training environment. The weight shape of the MatMul operator on each device is \[4, 8]. Load the initialized model parameter data from the integrated checkpoint file and then perform training. -> For details about the distributed environment configuration and training code, see [Distributed Training](https://www.mindspore.cn/tutorial/en/master/advanced_use/distributed_training.html). +> For details about the distributed environment configuration and training code, see [Distributed Training](https://www.mindspore.cn/tutorial/en/master/advanced_use/distributed_training_ascend.html). > > This document provides the example code for integrating checkpoint files and loading checkpoint files before distributed training. The code is for reference only. diff --git a/tutorials/source_en/advanced_use/host_device_training.md b/tutorials/source_en/advanced_use/host_device_training.md index d52d54d0b5..c63d735b0c 100644 --- a/tutorials/source_en/advanced_use/host_device_training.md +++ b/tutorials/source_en/advanced_use/host_device_training.md @@ -14,7 +14,7 @@ ## Overview -In deep learning, one usually has to deal with the huge model problem, in which the total size of parameters in the model is beyond the device memory capacity. To efficiently train a huge model, one solution is to employ homogenous accelerators (*e.g.*, Ascend 910 AI Accelerator and GPU) for [distributed training](https://www.mindspore.cn/tutorial/en/master/advanced_use/distributed_training.html). When the size of a model is hundreds of GBs or several TBs, +In deep learning, one usually has to deal with the huge model problem, in which the total size of parameters in the model is beyond the device memory capacity. To efficiently train a huge model, one solution is to employ homogenous accelerators (*e.g.*, Ascend 910 AI Accelerator and GPU) for distributed training. When the size of a model is hundreds of GBs or several TBs, the number of required accelerators is too overwhelming for people to access, resulting in this solution inapplicable. One alternative is Host+Device hybrid training. This solution simultaneously leveraging the huge memory in hosts and fast computation in accelerators, is a promisingly efficient method for addressing huge model problem. diff --git a/tutorials/source_en/advanced_use/mixed_precision.md b/tutorials/source_en/advanced_use/mixed_precision.md index c4b942be89..7d25e7fac5 100644 --- a/tutorials/source_en/advanced_use/mixed_precision.md +++ b/tutorials/source_en/advanced_use/mixed_precision.md @@ -10,7 +10,7 @@ - + ## Overview diff --git a/tutorials/source_en/advanced_use/quantization_aware.md b/tutorials/source_en/advanced_use/quantization_aware.md index c3839f7a5e..2d3098b85d 100644 --- a/tutorials/source_en/advanced_use/quantization_aware.md +++ b/tutorials/source_en/advanced_use/quantization_aware.md @@ -74,7 +74,7 @@ Compared with common training, the quantization aware training requires addition Next, the LeNet network is used as an example to describe steps 3 and 6. -> You can obtain the complete executable sample code at . +> You can obtain the complete executable sample code at . ### Defining a Fusion Network @@ -196,4 +196,4 @@ For details, see 具体分布式环境配置和训练部分代码,此处不做详细说明,可以参考[分布式并行训练](https://www.mindspore.cn/tutorial/zh-CN/master/advanced_use/distributed_training.html) +> 具体分布式环境配置和训练部分代码,此处不做详细说明,可以参考[分布式并行训练](https://www.mindspore.cn/tutorial/zh-CN/master/advanced_use/distributed_training_ascend.html) 章节。 > > 本文档附上对CheckPoint文件做合并处理以及分布式训练前加载CheckPoint文件的示例代码,仅作为参考,实际请参考具体情况实现。 diff --git a/tutorials/source_zh_cn/advanced_use/host_device_training.md b/tutorials/source_zh_cn/advanced_use/host_device_training.md index a64ad4101e..300b21ec8e 100644 --- a/tutorials/source_zh_cn/advanced_use/host_device_training.md +++ b/tutorials/source_zh_cn/advanced_use/host_device_training.md @@ -14,7 +14,7 @@ ## 概述 -在深度学习中,工作人员时常会遇到超大模型的训练问题,即模型参数所占内存超过了设备内存上限。为高效地训练超大模型,一种方案便是[分布式并行训练](https://www.mindspore.cn/tutorial/zh-CN/master/advanced_use/distributed_training.html),也就是将工作交由同构的多个加速器(如Ascend 910 AI处理器,GPU等)共同完成。但是这种方式在面对几百GB甚至几TB级别的模型时,所需的加速器过多。而当从业者实际难以获取大规模集群时,这种方式难以应用。另一种可行的方案是使用主机端(Host)和加速器(Device)的混合训练模式。此方案同时发挥了主机端内存大和加速器端计算快的优势,是一种解决超大模型训练较有效的方式。 +在深度学习中,工作人员时常会遇到超大模型的训练问题,即模型参数所占内存超过了设备内存上限。为高效地训练超大模型,一种方案便是分布式并行训练,也就是将工作交由同构的多个加速器(如Ascend 910 AI处理器,GPU等)共同完成。但是这种方式在面对几百GB甚至几TB级别的模型时,所需的加速器过多。而当从业者实际难以获取大规模集群时,这种方式难以应用。另一种可行的方案是使用主机端(Host)和加速器(Device)的混合训练模式。此方案同时发挥了主机端内存大和加速器端计算快的优势,是一种解决超大模型训练较有效的方式。 在MindSpore中,用户可以将待训练的参数放在主机,同时将必要算子的执行位置配置为主机,其余算子的执行位置配置为加速器,从而方便地实现混合训练。此教程以推荐模型[Wide&Deep](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/recommend/wide_and_deep)为例,讲解MindSpore在主机和Ascend 910 AI处理器的混合训练。 -- Gitee From 381da291a7ca3342338693e176f91ab3fed62163 Mon Sep 17 00:00:00 2001 From: bingyaweng Date: Mon, 10 Aug 2020 14:45:50 +0800 Subject: [PATCH 3/4] add mindspore.nn.probability add mindspore.nn.probability modify title underline --- .../python/mindspore/mindspore.nn.probability.rst | 14 ++++++++++++++ api/source_en/index.rst | 1 + .../python/mindspore/mindspore.nn.probability.rst | 14 ++++++++++++++ api/source_zh_cn/index.rst | 1 + 4 files changed, 30 insertions(+) create mode 100644 api/source_en/api/python/mindspore/mindspore.nn.probability.rst create mode 100644 api/source_zh_cn/api/python/mindspore/mindspore.nn.probability.rst diff --git a/api/source_en/api/python/mindspore/mindspore.nn.probability.rst b/api/source_en/api/python/mindspore/mindspore.nn.probability.rst new file mode 100644 index 0000000000..a08eb21773 --- /dev/null +++ b/api/source_en/api/python/mindspore/mindspore.nn.probability.rst @@ -0,0 +1,14 @@ +mindspore.nn.probability +======================== + +mindspore.nn.probability.distribution +------------------------------------- + +.. automodule:: mindspore.probability.distribution + :members: + +mindspore.nn.probability.bijector +--------------------------------- + +.. automodule:: mindspore.probability.bijector + :members: diff --git a/api/source_en/index.rst b/api/source_en/index.rst index 2232138ec5..c5053627a3 100644 --- a/api/source_en/index.rst +++ b/api/source_en/index.rst @@ -19,6 +19,7 @@ MindSpore API api/python/mindspore/mindspore.nn api/python/mindspore/mindspore.nn.dynamic_lr api/python/mindspore/mindspore.nn.learning_rate_schedule + api/python/mindspore/mindspore.nn.probability api/python/mindspore/mindspore.ops api/python/mindspore/mindspore.ops.composite api/python/mindspore/mindspore.ops.operations diff --git a/api/source_zh_cn/api/python/mindspore/mindspore.nn.probability.rst b/api/source_zh_cn/api/python/mindspore/mindspore.nn.probability.rst new file mode 100644 index 0000000000..4ec12a3099 --- /dev/null +++ b/api/source_zh_cn/api/python/mindspore/mindspore.nn.probability.rst @@ -0,0 +1,14 @@ +mindspore.nn.probability +======================== + +mindspore.nn.probability.distribution +------------------------------------- + +.. automodule:: mindspore.nn.probability.distribution + :members: + +mindspore.nn.probability.bijector +--------------------------------- + +.. automodule:: mindspore.nn.probability.bijector + :members: diff --git a/api/source_zh_cn/index.rst b/api/source_zh_cn/index.rst index 95d6c052aa..b0be7f2174 100644 --- a/api/source_zh_cn/index.rst +++ b/api/source_zh_cn/index.rst @@ -19,6 +19,7 @@ MindSpore API api/python/mindspore/mindspore.nn api/python/mindspore/mindspore.nn.dynamic_lr api/python/mindspore/mindspore.nn.learning_rate_schedule + api/python/mindspore/mindspore.nn.probability api/python/mindspore/mindspore.ops api/python/mindspore/mindspore.ops.composite api/python/mindspore/mindspore.ops.operations -- Gitee From 53ce3dec5b850ffbaf207ac4c41854d6fe6f4359 Mon Sep 17 00:00:00 2001 From: bingyaweng Date: Tue, 11 Aug 2020 09:52:11 +0800 Subject: [PATCH 4/4] modify nn.probability --- .../api/python/mindspore/mindspore.nn.probability.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/source_en/api/python/mindspore/mindspore.nn.probability.rst b/api/source_en/api/python/mindspore/mindspore.nn.probability.rst index a08eb21773..4ec12a3099 100644 --- a/api/source_en/api/python/mindspore/mindspore.nn.probability.rst +++ b/api/source_en/api/python/mindspore/mindspore.nn.probability.rst @@ -4,11 +4,11 @@ mindspore.nn.probability mindspore.nn.probability.distribution ------------------------------------- -.. automodule:: mindspore.probability.distribution +.. automodule:: mindspore.nn.probability.distribution :members: mindspore.nn.probability.bijector --------------------------------- -.. automodule:: mindspore.probability.bijector +.. automodule:: mindspore.nn.probability.bijector :members: -- Gitee