Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
docs
提交
5331a61e
D
docs
项目概览
MindSpore
/
docs
通知
4
Star
2
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
5331a61e
编写于
5月 15, 2020
作者:
G
gengdongjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove enable_task-sink param
上级
69fed9c3
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
5 addition
and
5 deletion
+5
-5
tutorials/source_zh_cn/advanced_use/distributed_training.md
tutorials/source_zh_cn/advanced_use/distributed_training.md
+2
-2
tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py
...ode/distributed_training/resnet50_distributed_training.py
+1
-1
tutorials/tutorial_code/resnet/cifar_resnet50.py
tutorials/tutorial_code/resnet/cifar_resnet50.py
+1
-1
tutorials/tutorial_code/sample_for_cloud/resnet50_train.py
tutorials/tutorial_code/sample_for_cloud/resnet50_train.py
+1
-1
未找到文件。
tutorials/source_zh_cn/advanced_use/distributed_training.md
浏览文件 @
5331a61e
...
...
@@ -249,7 +249,7 @@ from resnet import resnet50
device_id
=
int
(
os
.
getenv
(
'DEVICE_ID'
))
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
"Ascend"
)
context
.
set_context
(
enable_task_sink
=
True
,
device_id
=
device_id
)
# set task_sink and
device_id
context
.
set_context
(
device_id
=
device_id
)
# set
device_id
context
.
set_context
(
enable_loop_sink
=
True
)
def
test_train_cifar
(
num_classes
=
10
,
epoch_size
=
10
):
...
...
@@ -263,7 +263,7 @@ def test_train_cifar(num_classes=10, epoch_size=10):
model
.
train
(
epoch_size
,
dataset
,
callbacks
=
[
loss_cb
],
dataset_sink_mode
=
True
)
```
其中,
-
`dataset_sink_mode=True`
,
`enable_
task_sink=True`
,
`enable_loop_sink=True`
:表示采用数据集和任务
的下沉模式,即训练的计算下沉到硬件平台中执行。
-
`dataset_sink_mode=True`
,
`enable_
loop_sink=True`
:表示采用数据集
的下沉模式,即训练的计算下沉到硬件平台中执行。
-
`LossMonitor`
:能够通过回调函数返回Loss值,用于监控损失函数。
## 运行脚本
...
...
tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py
浏览文件 @
5331a61e
...
...
@@ -35,7 +35,7 @@ from resnet import resnet50
device_id
=
int
(
os
.
getenv
(
'DEVICE_ID'
))
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
"Ascend"
)
context
.
set_context
(
enable_task_sink
=
True
,
device_id
=
device_id
)
# set task_sink and
device_id
context
.
set_context
(
device_id
=
device_id
)
# set
device_id
context
.
set_context
(
enable_loop_sink
=
True
)
context
.
set_context
(
enable_mem_reuse
=
False
)
init
()
...
...
tutorials/tutorial_code/resnet/cifar_resnet50.py
浏览文件 @
5331a61e
...
...
@@ -54,7 +54,7 @@ device_id = int(os.getenv('DEVICE_ID'))
data_home
=
args_opt
.
dataset_path
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
"Ascend"
)
context
.
set_context
(
enable_task_sink
=
True
,
device_id
=
device_id
)
context
.
set_context
(
device_id
=
device_id
)
context
.
set_context
(
enable_loop_sink
=
False
)
context
.
set_context
(
enable_mem_reuse
=
False
)
...
...
tutorials/tutorial_code/sample_for_cloud/resnet50_train.py
浏览文件 @
5331a61e
...
...
@@ -116,7 +116,7 @@ def resnet50_train(args_opt):
# set graph mode and parallel mode
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
"Ascend"
,
save_graphs
=
False
)
context
.
set_context
(
enable_task_sink
=
True
,
device_id
=
device_id
)
context
.
set_context
(
device_id
=
device_id
)
context
.
set_context
(
enable_loop_sink
=
True
)
context
.
set_context
(
enable_mem_reuse
=
True
)
if
device_num
>
1
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录