提交 2e3f9bc4 编写于 作者: L leiyuning

add hardware info

上级 474016c6
......@@ -62,7 +62,7 @@ Next, let's use MindSpore to solve the image classification task. The overall pr
5. Call the high-level `Model` API to train and save the model file.
6. Load the saved model for inference.
> This example is for the hardware platform of the Ascend 910 AI processor, download the complete code at <https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/resnet>.
> This example is for the hardware platform of the Ascend 910 AI processor. You can find the complete executable sample code at: <https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/resnet>.
The key parts of the task process code are explained below.
......
......@@ -28,11 +28,8 @@ Among them:
- Cost model: A cost model built based on the memory computing cost and communication cost, for which an efficient algorithm is designed to find the parallel strategy with the shorter training time.
In this tutorial, we will learn how to train the ResNet-50 network in `DATA_PARALLEL` or `AUTO_PARALLEL` mode on MindSpore.
For sample code, please see at
<https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py>.
> The current sample is for the Ascend AI processor.
> The current sample is for the Ascend 910 AI processor. You can find the complete executable sample code at:<https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py>.
## Preparations
......
......@@ -27,9 +27,9 @@ At the beginning of AI algorithm design, related security threats are sometimes
This section describes how to use MindArmour in adversarial attack and defense by taking the Fast Gradient Sign Method (FGSM) attack algorithm and Natural Adversarial Defense (NAD) algorithm as examples.
> You can find the complete executable sample code at
> <https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/model_safety/mnist_attack_fgsm.py>
> and <https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/model_safety/mnist_defense_nad.py>
> The current sample is for CPU, GPU and Ascend 910 AI processor. You can find the complete executable sample code at:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/model_safety>
> - mnist_attack_fgsm.py: contains attack code.
> - mnist_defense_nad.py: contains defense code.
## Creating an Target Model
......
......@@ -17,7 +17,6 @@
- [Training and Saving the Model](#training-and-saving-the-model)
- [Validating the Model](#validating-the-model)
- [Experiment Result](#experiment-result)
- [Downloading Code](#downloading-code)
<!-- /TOC -->
......@@ -84,6 +83,9 @@ Currently, MindSpore GPU supports the long short-term memory (LSTM) network for
Long short-term memory (LSTM) is an artificial recurrent neural network (RNN) architecture used for processing and predicting an important event with a long interval and delay in a time sequence. For details, refer to online documentation.
3. After the model is obtained, use the validation dataset to check the accuracy of model.
> The current sample is for the Ascend 910 AI processor. You can find the complete executable sample code at:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/lstm>
> - main.py: code file, including code for data preprocessing, network definition, and model training.
> - config.py: some configurations on the network, including the batch size and number of training epochs.
## Implementation
......@@ -531,9 +533,3 @@ RegisterOperatorCreator:OperatorCreators init
============== Accuracy:{'acc': 0.8599358974358975} ==============
```
## Downloading Code
Complete and executable code download address: <https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/lstm>
- main.py: code file, including code for data preprocessing, network definition, and model training.
- config.py: some configurations on the network, including the batch size and number of training epochs.
......@@ -63,7 +63,7 @@ MindSpore当前支持的图像分类网络包括:典型网络LeNet、AlexNet
6. 加载保存的模型进行推理
> 本例面向Ascend 910 AI处理器硬件平台,样例的完整代码下载<https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/resnet>
> 本例面向Ascend 910 AI处理器硬件平台,你可以在这里下载完整的样例代码:<https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/resnet>
下面对任务流程中各个环节及代码关键片段进行解释说明。
......
......@@ -28,9 +28,7 @@ MindSpore支持数据并行及自动并行。自动并行是MindSpore融合了
- 代价模型(Cost Model):同时考虑内存的计算代价和通信代价对训练时间建模,并设计了高效的算法来找到训练时间较短的并行策略。
本篇教程我们主要了解如何在MindSpore上通过数据并行及自动并行模式训练ResNet-50网络。
样例代码请参考 <https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py>
> 当前样例面向Ascend AI处理器。
> 本例面向Ascend 910 AI处理器硬件平台,你可以在这里下载完整的样例代码:<https://gitee.com/mindspore/docs/blob/master/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py>
## 准备环节
......
......@@ -25,9 +25,10 @@ AI算法设计之初普遍未考虑相关的安全威胁,使得AI算法的判
- 评估模块提供多种指标全面评估对抗样本攻防性能。
这里通过图像分类任务上的对抗性攻防,以攻击算法FGSM和防御算法NAD为例,介绍MindArmour在对抗攻防上的使用方法。
> 你可以在这里找到完整可运行的样例代码:
> 攻击代码:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/model_safety/mnist_attack_fgsm.py>
> 防御代码:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/model_safety/mnist_defense_nad.py>
> 本例面向CPU、GPU、Ascend 910 AI处理器,你可以在这里下载完整的样例代码:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/model_safety>
> - mnist_attack_fgsm.py:包含攻击代码。
> - mnist_defense_nad.py:包含防御代码。
## 建立被攻击模型
......
......@@ -17,7 +17,6 @@
- [训练并保存模型](#训练并保存模型)
- [模型验证](#模型验证)
- [实验结果](#实验结果)
- [下载代码](#下载代码)
<!-- /TOC -->
......@@ -78,13 +77,15 @@ $F1分数 = (2 * Precision * Recall) / (Precision + Recall)$
### 确定网络及流程
当前,MindSpore GPU版本支持LSTM网络,我们使用LSTM网络进行自然语言处理。
我们使用LSTM网络进行自然语言处理。
1. 加载使用的数据集,并进行必要的数据处理。
2. 使用LSTM网络训练数据,生成模型。
> LSTM(Long short-term memory,长短期记忆)网络是一种时间循环神经网络,适合于处理和预测时间序列中间隔和延迟非常长的重要事件。具体介绍可参考网上资料,在此不再赘述。
3. 得到模型之后,使用验证数据集,查看模型精度情况。
> 本例面向GPU硬件平台,你可以在这里下载完整的样例代码:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/lstm>
> - main.py:代码文件,包括数据预处理、网络定义、模型训练等代码。
> - config.py:网络中的一些配置,包括batch size、进行几次epoch训练等。
## 实现阶段
### 导入需要的库文件
......@@ -531,9 +532,5 @@ RegisterOperatorCreator:OperatorCreators init
============== Accuracy:{'acc': 0.8599358974358975} ==============
```
## 下载代码
完整可运行代码下载地址:<https://gitee.com/mindspore/docs/tree/master/tutorials/tutorial_code/lstm>
- main.py:代码文件,包括数据预处理、网络定义、模型训练等代码。
- config.py:网络中的一些配置,包括batch size、进行几次epoch训练等。
......@@ -28,7 +28,7 @@ MindSpore可以加载常见的标准数据集。支持的数据集如下表:
| ImageNet | ImageNet是根据WordNet层次结构组织的图像数据库,其中层次结构的每个节点都由成百上千个图像表示。 |
| MNIST | 是一个手写数字图像的大型数据库,通常用于训练各种图像处理系统。 |
| CIFAR-10 | 常用于训练图像的采集机器学习和计算机视觉算法。CIFAR-10数据集包含10种不同类别的60,000张32x32彩色图像。 |
| CIFAR-100 | 该数据集类似于CIFAR-10,不同之处在于它有100个类别,每个类别包含600张图像。每个课程有500张训练图像和100张测试图像。 |
| CIFAR-100 | 该数据集类似于CIFAR-10,不同之处在于它有100个类别,每个类别包含600张图像500张训练图像和100张测试图像。 |
| PASCAL-VOC | 数据内容多样,可用于训练计算机视觉模型(分类、定位、检测、分割、动作识别等)。 |
| CelebA | CelebA人脸数据集包含上万个名人身份的人脸图片,每张图片有40个特征标记,常用于人脸相关的训练任务。 |
......
......@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""resnet50_distributed_training"""
"""resnet50_distributed_training
The sample can be run on Ascend 910 AI processor.
"""
import os
import random
import argparse
......
......@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Lenet Tutorial"""
"""Lenet Tutorial
The sample can be run on CPU, GPU and Ascend 910 AI processor.
"""
import os
import urllib.request
from urllib.parse import urlparse
......
......@@ -14,6 +14,7 @@
# ============================================================================
"""
LSTM Tutorial
The sample can be run on GPU.
"""
import os
import shutil
......
......@@ -11,6 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
mnist_attack_fgsm
The sample can be run on Ascend 910 AI processor.
"""
import sys
import time
import numpy as np
......
......@@ -11,7 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""defense example using nad"""
"""Defense example using nad
The sample can be run on CPU, GPU and Ascend 910 AI processor.
"""
import sys
import logging
......
......@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
'''cifar_resnet50'''
'''cifar_resnet50
The sample can be run on Ascend 910 AI processor.
'''
import os
import random
import argparse
......
......@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
'''resnet'''
'''resnet
The sample can be run on Ascend 910 AI processor.
'''
import numpy as np
import mindspore.nn as nn
from mindspore import Tensor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册