forked from huawei/mindspore2022
!19015 modify callback comment
Merge pull request !19015 from changzherui/fix_callback_comment
This commit is contained in:
commit
6788a45bd5
|
|
@ -80,6 +80,7 @@ class Callback:
|
|||
Callback function will execute some operations in the current step or epoch.
|
||||
|
||||
Examples:
|
||||
>>> from mindspore.train._callback import Callback
|
||||
>>> class Print_info(Callback):
|
||||
>>> def step_end(self, run_context):
|
||||
>>> cb_params = run_context.original_args()
|
||||
|
|
@ -87,7 +88,6 @@ class Callback:
|
|||
>>> print(cb_params.cur_step_num)
|
||||
>>>
|
||||
>>> print_cb = Print_info()
|
||||
>>> model.train(epoch, dataset, callbacks=print_cb)
|
||||
"""
|
||||
|
||||
def __enter__(self):
|
||||
|
|
@ -123,7 +123,7 @@ class Callback:
|
|||
|
||||
def step_begin(self, run_context):
|
||||
"""
|
||||
Called before each epoch beginning.
|
||||
Called before each step beginning.
|
||||
|
||||
Args:
|
||||
run_context (RunContext): Include some information of the model.
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class CheckpointConfig:
|
|||
save_checkpoint_seconds (int): Seconds to save checkpoint.
|
||||
Can't be used with save_checkpoint_steps at the same time. Default: 0.
|
||||
keep_checkpoint_max (int): Maximum number of checkpoint files can be saved. Default: 5.
|
||||
keep_checkpoint_per_n_minutes (int): Keep one checkpoint every n minutes.
|
||||
keep_checkpoint_per_n_minutes (int): Save the checkpoint file every `keep_checkpoint_per_n_minutes` minutes.
|
||||
Can't be used with keep_checkpoint_max at the same time. Default: 0.
|
||||
integrated_save (bool): Whether to perform integrated save function in automatic model parallel scene.
|
||||
Integrated save function is only supported in automatic parallel scene, not supported
|
||||
|
|
@ -83,7 +83,7 @@ class CheckpointConfig:
|
|||
async_save (bool): Whether asynchronous execution saves the checkpoint to a file. Default: False.
|
||||
saved_network (Cell): Network to be saved in checkpoint file. If the saved_network has no relation
|
||||
with the network in training, the initial value of saved_network will be saved. Default: None.
|
||||
append_info (List): The information save to checkpoint file. Support "epoch_num"、"step_num"、and dict.
|
||||
append_info (list): The information save to checkpoint file. Support "epoch_num"、"step_num"、and dict.
|
||||
The key of dict must be str, the value of dict must be one of int float and bool. Default: None.
|
||||
enc_key (Union[None, bytes]): Byte type key used for encryption. If the value is None, the encryption
|
||||
is not required. Default: None.
|
||||
|
|
@ -94,6 +94,9 @@ class CheckpointConfig:
|
|||
ValueError: If input parameter is not the correct type.
|
||||
|
||||
Examples:
|
||||
>>> from mindspore import Model, nn
|
||||
>>> from mindspore.train.callback import ModelCheckpoint, CheckpointConfig
|
||||
>>>
|
||||
>>> class LeNet5(nn.Cell):
|
||||
>>> def __init__(self, num_class=10, num_channel=1):
|
||||
>>> super(LeNet5, self).__init__()
|
||||
|
|
@ -277,7 +280,8 @@ class ModelCheckpoint(Callback):
|
|||
|
||||
Args:
|
||||
prefix (str): The prefix name of checkpoint files. Default: "CKP".
|
||||
directory (str): The path of the folder which will be saved in the checkpoint file. Default: None.
|
||||
directory (str): The path of the folder which will be saved in the checkpoint file.
|
||||
By default, the file is saved in the current directory. Default: None.
|
||||
config (CheckpointConfig): Checkpoint strategy configuration. Default: None.
|
||||
|
||||
Raises:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class LossMonitor(Callback):
|
|||
If per_print_times is 0, do not print loss.
|
||||
|
||||
Args:
|
||||
per_print_times (int): Print the loss each every time. Default: 1.
|
||||
per_print_times (int): Print the loss each every seconds. Default: 1.
|
||||
|
||||
Raises:
|
||||
ValueError: If per_print_times is not an integer or less than zero.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ class TimeMonitor(Callback):
|
|||
Monitor the time in training.
|
||||
|
||||
Args:
|
||||
data_size (int): How many steps to return time information default is dataset size. Default: None.
|
||||
data_size (int): How many steps are the intervals between print information each time.
|
||||
if the program get `batch_num` during training, `data_size` will be set to `batch_num`,
|
||||
otherwise `data_size` will be used. Default: None.
|
||||
|
||||
Raises:
|
||||
ValueError: If data_size is not positive int.
|
||||
|
|
|
|||
Loading…
Reference in New Issue