forked from huawei/mindspore2022
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
Class mindspore.train.callback.ModelCheckpoint(prefix='CKP', directory=None, config=None)
|
||
|
||
checkpoint的回调函数。
|
||
|
||
在训练过程中调用该方法可以保存训练后的网络参数。
|
||
|
||
注:
|
||
在分布式训练场景下,请为每个训练进程指定不同的目录来保存checkpoint文件。否则,可能会训练失败。
|
||
|
||
参数:
|
||
prefix (str):checkpoint文件的前缀名称。默认值:CKP。
|
||
directory (str):保存checkpoint文件的文件夹路径。
|
||
默认情况下,文件保存在当前目录下。默认值:None。
|
||
config (CheckpointConfig):checkpoint策略配置。默认值:None。
|
||
|
||
异常:
|
||
ValueError:如果前缀无效。
|
||
TypeError:config不是CheckpointConfig类型。
|
||
|
||
|
||
end(run_context)
|
||
|
||
在训练结束后,会保存最后一个step的checkpoint。
|
||
|
||
参数:
|
||
run_context (RunContext):包含模型的一些基本信息。
|
||
|
||
|
||
latest_ckpt_file_name
|
||
返回最新的checkpoint路径和文件名。
|
||
|
||
step_end(run_context)
|
||
|
||
在step结束时保存checkpoint。
|
||
|
||
参数:
|
||
run_context (RunContext):包含模型的一些基本信息。
|
||
|