Saves the optimizer and network states during training. The final network and optimizer are always stored.
Details
Saving the learner itself in the callback with a trained model is impossible, as the model slot is set after the last callback step is executed.
See also
Other Callback:
TorchCallback
,
as_torch_callback()
,
as_torch_callbacks()
,
callback_set()
,
mlr3torch_callbacks
,
mlr_callback_set
,
mlr_callback_set.progress
,
mlr_context_torch
,
t_clbk()
,
torch_callback()
Super class
mlr3torch::CallbackSet
-> CallbackSetCheckpoint
Methods
Method new()
Creates a new instance of this R6 class.
Usage
CallbackSetCheckpoint$new(path, freq, freq_type = "epoch")
Arguments
path
(
character(1)
)
The path to a folder where the models are saved.freq
(
integer(1)
)
The frequency how often the model is saved. Frequency is either per step or epoch, which can be configured through thefreq_type
parameter.freq_type
(
character(1)
)
Can be be either"epoch"
(default) or"step"
.
Method on_epoch_end()
Saves the network and optimizer state dict.
Does nothing if freq_type
or freq
are not met.
Method on_batch_end()
Saves the selected objects defined in save
.
Does nothing if freq_type or freq are not met.