luz_callback_model_checkpoint {luz} | R Documentation |
Checkpoints model weights
Description
This saves checkpoints of the model according to the specified metric and behavior.
Usage
luz_callback_model_checkpoint(
path,
monitor = "valid_loss",
save_best_only = FALSE,
mode = "min",
min_delta = 0
)
Arguments
path |
Path to save the model on disk. The path is interpolated with |
monitor |
A string in the format |
save_best_only |
if |
mode |
Specifies the direction that is considered an improvement. By default 'min' is used. Can also be 'max' (higher is better) and 'zero' (closer to zero is better). |
min_delta |
Minimum difference to consider as improvement. Only used when
|
Note
mode
and min_delta
are only used when save_best_only=TRUE
.
save_best_only
will overwrite the saved models if the path
parameter
don't differentiate by epochs.
Read the checkpointing article in the pkgdown website for more information.
See Also
Other luz_callbacks:
luz_callback_auto_resume()
,
luz_callback_csv_logger()
,
luz_callback_early_stopping()
,
luz_callback_interrupt()
,
luz_callback_keep_best_model()
,
luz_callback_lr_scheduler()
,
luz_callback_metrics()
,
luz_callback_mixup()
,
luz_callback_profile()
,
luz_callback_progress()
,
luz_callback_resume_from_checkpoint()
,
luz_callback_train_valid()
,
luz_callback()
Examples
luz_callback_model_checkpoint(path= "path/to/dir")
luz_callback_model_checkpoint(path= "path/to/dir/epoch-{epoch:02d}/model.pt")
luz_callback_model_checkpoint(path= "path/to/dir/epoch-{epoch:02d}/model-{monitor:.2f}.pt")