diff --git a/tutorials/source_en/advanced_use/computer_vision_application.md b/tutorials/source_en/advanced_use/computer_vision_application.md index 1e1c6e45288023585905f0d5b2a31fd77fd641f6..388e9816c43842d474f2816a6ddd057e9600e4ed 100644 --- a/tutorials/source_en/advanced_use/computer_vision_application.md +++ b/tutorials/source_en/advanced_use/computer_vision_application.md @@ -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 . +> This example is for the hardware platform of the Ascend 910 AI processor. You can find the complete executable sample code at: . The key parts of the task process code are explained below. diff --git a/tutorials/source_en/advanced_use/distributed_training.md b/tutorials/source_en/advanced_use/distributed_training.md index c34146b9b3d5c92cdf16898a25b78876d22d4175..eefab7b1b44eccd8906bb290b40008e347b0091a 100644 --- a/tutorials/source_en/advanced_use/distributed_training.md +++ b/tutorials/source_en/advanced_use/distributed_training.md @@ -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 -. - -> 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:. ## Preparations diff --git a/tutorials/source_en/advanced_use/model_security.md b/tutorials/source_en/advanced_use/model_security.md index 98b941af35cbd561c50a34693f3dbb22f663a5ad..5a3a09f34a622872122c8a10b535d6d40099f159 100644 --- a/tutorials/source_en/advanced_use/model_security.md +++ b/tutorials/source_en/advanced_use/model_security.md @@ -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 -> -> and +> The current sample is for CPU, GPU and Ascend 910 AI processor. You can find the complete executable sample code at: +> - mnist_attack_fgsm.py: contains attack code. +> - mnist_defense_nad.py: contains defense code. ## Creating an Target Model diff --git a/tutorials/source_en/advanced_use/nlp_application.md b/tutorials/source_en/advanced_use/nlp_application.md index a9944dbc971405fcbbda392aed718f729be9deba..9ec0a1de9e6d74c21826194235656113e62c738b 100644 --- a/tutorials/source_en/advanced_use/nlp_application.md +++ b/tutorials/source_en/advanced_use/nlp_application.md @@ -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) @@ -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: +> - 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: - -- 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. - diff --git a/tutorials/source_zh_cn/advanced_use/computer_vision_application.md b/tutorials/source_zh_cn/advanced_use/computer_vision_application.md index ca7c15ce61272d4d6e3cb566db73c22b8f69131e..0135c636c84649fa8aa449126fe3abb40be2b3c0 100644 --- a/tutorials/source_zh_cn/advanced_use/computer_vision_application.md +++ b/tutorials/source_zh_cn/advanced_use/computer_vision_application.md @@ -63,7 +63,7 @@ MindSpore当前支持的图像分类网络包括:典型网络LeNet、AlexNet 6. 加载保存的模型进行推理 -> 本例面向Ascend 910 AI处理器硬件平台,样例的完整代码下载 +> 本例面向Ascend 910 AI处理器硬件平台,你可以在这里下载完整的样例代码: 下面对任务流程中各个环节及代码关键片段进行解释说明。 diff --git a/tutorials/source_zh_cn/advanced_use/distributed_training.md b/tutorials/source_zh_cn/advanced_use/distributed_training.md index 8071832fe081cdc1c39fee8314c802df402faf69..7c2b93fee7d10ec3e4aa4c7661165aa8ff4eb3fc 100644 --- a/tutorials/source_zh_cn/advanced_use/distributed_training.md +++ b/tutorials/source_zh_cn/advanced_use/distributed_training.md @@ -28,9 +28,7 @@ MindSpore支持数据并行及自动并行。自动并行是MindSpore融合了 - 代价模型(Cost Model):同时考虑内存的计算代价和通信代价对训练时间建模,并设计了高效的算法来找到训练时间较短的并行策略。 本篇教程我们主要了解如何在MindSpore上通过数据并行及自动并行模式训练ResNet-50网络。 -样例代码请参考 。 - -> 当前样例面向Ascend AI处理器。 +> 本例面向Ascend 910 AI处理器硬件平台,你可以在这里下载完整的样例代码: ## 准备环节 diff --git a/tutorials/source_zh_cn/advanced_use/model_security.md b/tutorials/source_zh_cn/advanced_use/model_security.md index 290ce420583d54cd2804ce10547db3da505b1dfc..2e3d7de91d1fe899f7fe759d51c17313184de302 100644 --- a/tutorials/source_zh_cn/advanced_use/model_security.md +++ b/tutorials/source_zh_cn/advanced_use/model_security.md @@ -25,9 +25,10 @@ AI算法设计之初普遍未考虑相关的安全威胁,使得AI算法的判 - 评估模块提供多种指标全面评估对抗样本攻防性能。 这里通过图像分类任务上的对抗性攻防,以攻击算法FGSM和防御算法NAD为例,介绍MindArmour在对抗攻防上的使用方法。 -> 你可以在这里找到完整可运行的样例代码: -> 攻击代码: -> 防御代码: + +> 本例面向CPU、GPU、Ascend 910 AI处理器,你可以在这里下载完整的样例代码: +> - mnist_attack_fgsm.py:包含攻击代码。 +> - mnist_defense_nad.py:包含防御代码。 ## 建立被攻击模型 diff --git a/tutorials/source_zh_cn/advanced_use/nlp_application.md b/tutorials/source_zh_cn/advanced_use/nlp_application.md index 7e9ef8cecff204d7eeb079cce10602d32c741f1b..bc4c7bb18b9c0b768c63b1780d3679d87ed09c3f 100644 --- a/tutorials/source_zh_cn/advanced_use/nlp_application.md +++ b/tutorials/source_zh_cn/advanced_use/nlp_application.md @@ -17,7 +17,6 @@ - [训练并保存模型](#训练并保存模型) - [模型验证](#模型验证) - [实验结果](#实验结果) - - [下载代码](#下载代码) @@ -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硬件平台,你可以在这里下载完整的样例代码: +> - main.py:代码文件,包括数据预处理、网络定义、模型训练等代码。 +> - config.py:网络中的一些配置,包括batch size、进行几次epoch训练等。 ## 实现阶段 ### 导入需要的库文件 @@ -531,9 +532,5 @@ RegisterOperatorCreator:OperatorCreators init ============== Accuracy:{'acc': 0.8599358974358975} ============== ``` -## 下载代码 -完整可运行代码下载地址: -- main.py:代码文件,包括数据预处理、网络定义、模型训练等代码。 -- config.py:网络中的一些配置,包括batch size、进行几次epoch训练等。 diff --git a/tutorials/source_zh_cn/use/data_preparation/loading_the_datasets.md b/tutorials/source_zh_cn/use/data_preparation/loading_the_datasets.md index dfe7edb69cb3569799c5190e43730812967974e3..f46f84ae9e6e400cec22cad29094e783387e21df 100644 --- a/tutorials/source_zh_cn/use/data_preparation/loading_the_datasets.md +++ b/tutorials/source_zh_cn/use/data_preparation/loading_the_datasets.md @@ -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个特征标记,常用于人脸相关的训练任务。 | diff --git a/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py b/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py index e363047ca876dd86c5f34ba3699c40bde59ad13c..54bd1bc3aab5ef608775f0edaa1a8ab9528534be 100644 --- a/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py +++ b/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py @@ -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 diff --git a/tutorials/tutorial_code/lenet.py b/tutorials/tutorial_code/lenet.py index a9b4571ffb5f0035dc2f0215853ddbc0107813a6..5170e6c5114714d8be6e615b33d2f7752019eb37 100644 --- a/tutorials/tutorial_code/lenet.py +++ b/tutorials/tutorial_code/lenet.py @@ -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 diff --git a/tutorials/tutorial_code/lstm/main.py b/tutorials/tutorial_code/lstm/main.py index 4cccb982672231d758026e64c12ac044fe18be70..dde13eb85f6a583bca848aad66a596843a75f8c0 100644 --- a/tutorials/tutorial_code/lstm/main.py +++ b/tutorials/tutorial_code/lstm/main.py @@ -14,6 +14,7 @@ # ============================================================================ """ LSTM Tutorial +The sample can be run on GPU. """ import os import shutil diff --git a/tutorials/tutorial_code/model_safety/mnist_attack_fgsm.py b/tutorials/tutorial_code/model_safety/mnist_attack_fgsm.py index 8d08724213e52025d8a34bcd9e5fcc96d1587395..9561b5cebdd5883aff2e1b0ddfec85a361c81b38 100644 --- a/tutorials/tutorial_code/model_safety/mnist_attack_fgsm.py +++ b/tutorials/tutorial_code/model_safety/mnist_attack_fgsm.py @@ -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 diff --git a/tutorials/tutorial_code/model_safety/mnist_defense_nad.py b/tutorials/tutorial_code/model_safety/mnist_defense_nad.py index 36b5417c90ecee2a75cfaac3a30ef9ea1158f875..a76c2a6016a34d6cdde18b897295021aef384935 100644 --- a/tutorials/tutorial_code/model_safety/mnist_defense_nad.py +++ b/tutorials/tutorial_code/model_safety/mnist_defense_nad.py @@ -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 diff --git a/tutorials/tutorial_code/resnet/cifar_resnet50.py b/tutorials/tutorial_code/resnet/cifar_resnet50.py index eedf7e0c4d172a42ba568649e32b60ea90c99904..7da052a8b9dcda3ea2154e252e55fd3da7d14e5f 100644 --- a/tutorials/tutorial_code/resnet/cifar_resnet50.py +++ b/tutorials/tutorial_code/resnet/cifar_resnet50.py @@ -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 diff --git a/tutorials/tutorial_code/resnet/resnet.py b/tutorials/tutorial_code/resnet/resnet.py index 82434acd1dcd5082f37b4b7ebebe14a4edcac2ce..d01555638b7a1371c8a555dae22f1171f0d7f017 100644 --- a/tutorials/tutorial_code/resnet/resnet.py +++ b/tutorials/tutorial_code/resnet/resnet.py @@ -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