mxnet.callback.do_checkpoint¶
-
mxnet.callback.
do_checkpoint
(prefix, period=1)[source]¶ A callback that saves a model checkpoint every few epochs. Each checkpoint is made up of a couple of binary files: a model description file and a parameters (weights and biases) file. The model description file is named prefix–symbol.json and the parameters file is named prefix-epoch_number.params
- Parameters
prefix (str) – Prefix for the checkpoint filenames.
period (int, optional) – Interval (number of epochs) between checkpoints. Default period is 1.
- Returns
callback – A callback function that can be passed as epoch_end_callback to fit.
- Return type
function
Example
>>> module.fit(iterator, num_epoch=n_epoch, ... epoch_end_callback = mx.callback.do_checkpoint("mymodel", 1)) Start training with [cpu(0)] Epoch[0] Resetting Data Iterator Epoch[0] Time cost=0.100 Saved checkpoint to "mymodel-0001.params" Epoch[1] Resetting Data Iterator Epoch[1] Time cost=0.060 Saved checkpoint to "mymodel-0002.params"