Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
docs
提交
91d69325
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看板
提交
91d69325
编写于
9月 02, 2020
作者:
L
liuyang_655
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify save_checkpoint
上级
6737369c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
10 addition
and
10 deletion
+10
-10
tutorials/source_en/advanced_use/checkpoint_for_hybrid_parallel.md
.../source_en/advanced_use/checkpoint_for_hybrid_parallel.md
+1
-1
tutorials/source_en/advanced_use/customized_debugging_information.md
...ource_en/advanced_use/customized_debugging_information.md
+2
-2
tutorials/source_zh_cn/advanced_use/checkpoint_for_hybrid_parallel.md
...urce_zh_cn/advanced_use/checkpoint_for_hybrid_parallel.md
+1
-1
tutorials/source_zh_cn/advanced_use/customized_debugging_information.md
...ce_zh_cn/advanced_use/customized_debugging_information.md
+2
-2
tutorials/source_zh_cn/advanced_use/gradient_accumulation.md
tutorials/source_zh_cn/advanced_use/gradient_accumulation.md
+2
-2
tutorials/tutorial_code/gradient_accumulation/train.py
tutorials/tutorial_code/gradient_accumulation/train.py
+2
-2
未找到文件。
tutorials/source_en/advanced_use/checkpoint_for_hybrid_parallel.md
浏览文件 @
91d69325
...
...
@@ -165,7 +165,7 @@ The parameter name is model\_parallel\_weight and the dividing strategy is to pe
2.
Call the
`save_checkpoint`
API to write the parameter data to a file and generate a new checkpoint file.
```
save_checkpoint(
param_list
, “./CKP-Integrated_1-4_32.ckpt”)
save_checkpoint(
save_obj
, “./CKP-Integrated_1-4_32.ckpt”)
```
In the preceding information:
...
...
tutorials/source_en/advanced_use/customized_debugging_information.md
浏览文件 @
91d69325
...
...
@@ -138,7 +138,7 @@ Here are two examples to further understand the usage of custom Callback.
-
Save the checkpoint file with the highest accuracy during training.
```python
from mindspore.train.serialization import
_exec_
save_checkpoint
from mindspore.train.serialization import save_checkpoint
class SaveCallback(Callback):
def __init__(self, model, eval_dataset):
...
...
@@ -155,7 +155,7 @@ Here are two examples to further understand the usage of custom Callback.
if result['acc'] > self.acc:
self.acc = result['acc']
file_name = str(self.acc) + ".ckpt"
_exec_save_checkpoint(train_network
=cb_params.train_network, ckpt_file_name=file_name)
save_checkpoint(save_obj
=cb_params.train_network, ckpt_file_name=file_name)
print("Save the maximum accuracy checkpoint,the accuracy is", self.acc)
...
...
tutorials/source_zh_cn/advanced_use/checkpoint_for_hybrid_parallel.md
浏览文件 @
91d69325
...
...
@@ -169,7 +169,7 @@ strategy = build_searched_strategy("./strategy_train.cpkt")
2.
调用
`save_checkpoint`
接口,将参数数据写入文件,生成新的CheckPoint文件。
```
save_checkpoint(
param_list
, “./CKP-Integrated_1-4_32.ckpt”)
save_checkpoint(
save_obj
, “./CKP-Integrated_1-4_32.ckpt”)
```
其中,
-
`save_checkpoint`
: 通过该接口将网络模型参数信息存入文件。
...
...
tutorials/source_zh_cn/advanced_use/customized_debugging_information.md
浏览文件 @
91d69325
...
...
@@ -140,7 +140,7 @@ Callback可以把训练过程中的重要信息记录下来,通过一个字典
-
保存训练过程中精度最高的checkpoint文件。
```python
from mindspore.train.serialization import
_exec_
save_checkpoint
from mindspore.train.serialization import save_checkpoint
class SaveCallback(Callback):
def __init__(self, model, eval_dataset):
...
...
@@ -157,7 +157,7 @@ Callback可以把训练过程中的重要信息记录下来,通过一个字典
if result['acc'] > self.acc:
self.acc = result['acc']
file_name = str(self.acc) + ".ckpt"
_exec_save_checkpoint(train_network
=cb_params.train_network, ckpt_file_name=file_name)
save_checkpoint(save_obj
=cb_params.train_network, ckpt_file_name=file_name)
print("Save the maximum accuracy checkpoint,the accuracy is", self.acc)
...
...
tutorials/source_zh_cn/advanced_use/gradient_accumulation.md
浏览文件 @
91d69325
...
...
@@ -52,7 +52,7 @@ from mindspore.ops import composite as C
from
mindspore.ops
import
functional
as
F
from
mindspore.ops
import
operations
as
P
from
mindspore.train.dataset_helper
import
DatasetHelper
from
mindspore.train.serialization
import
_exec_
save_checkpoint
from
mindspore.train.serialization
import
save_checkpoint
from
model_zoo.official.cv.lenet.src.dataset
import
create_dataset
from
model_zoo.official.cv.lenet.src.lenet
import
LeNet5
```
...
...
@@ -199,7 +199,7 @@ class GradientAccumulation:
train_dataset
.
reset
()
_exec_
save_checkpoint
(
self
.
_train_forward_backward
,
"gradient_accumulation.ckpt"
,
)
save_checkpoint
(
self
.
_train_forward_backward
,
"gradient_accumulation.ckpt"
,
)
```
### 训练并保存模型
...
...
tutorials/tutorial_code/gradient_accumulation/train.py
浏览文件 @
91d69325
...
...
@@ -9,7 +9,7 @@ from mindspore.ops import composite as C
from
mindspore.ops
import
functional
as
F
from
mindspore.ops
import
operations
as
P
from
mindspore.train.dataset_helper
import
DatasetHelper
from
mindspore.train.serialization
import
_exec_
save_checkpoint
from
mindspore.train.serialization
import
save_checkpoint
from
model_zoo.official.cv.lenet.src.dataset
import
create_dataset
from
model_zoo.official.cv.lenet.src.lenet
import
LeNet5
...
...
@@ -124,7 +124,7 @@ class GradientAccumulation:
train_dataset
.
reset
()
_exec_
save_checkpoint
(
self
.
_train_forward_backward
,
"gradient_accumulation.ckpt"
,
)
save_checkpoint
(
self
.
_train_forward_backward
,
"gradient_accumulation.ckpt"
,
)
if
__name__
==
"__main__"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录