scvi.train.SaveCheckpoint#
- class scvi.train.SaveCheckpoint(dirpath=None, filename=None, monitor='validation_loss', **kwargs)[source]#
Bases:
ModelCheckpointEXPERIMENTALSaves model checkpoints based on a monitored metric.Inherits from
ModelCheckpointand modifies the default behavior to save the full model state instead of just the state dict. This is necessary for compatibility withBaseModelClass.The best model save and best model score based on
monitorcan be accessed post-training with thebest_model_pathandbest_model_scoreattributes, respectively.Known issues:
Does not set
train_indices,validation_indices, andtest_indicesfor checkpoints.Does not set
historyfor checkpoints. This can be accessed in the final model however.Unsupported arguments:
save_weights_onlyandsave_last
- Parameters:
dirpath (
str|None(default:None)) – Base directory to save the model checkpoints. IfNone, defaults to a directory formatted with the current date, time, and monitor withinsettings.logging_dir.filename (
str|None(default:None)) – Name of the checkpoint directories. Can contain formatting options to be auto-filled. IfNone, defaults to{epoch}-{step}-{monitor}.monitor (
str(default:'validation_loss')) – Metric to monitor for checkpointing.**kwargs – Additional keyword arguments passed into
ModelCheckpoint.
Attributes table#
Methods table#
|
Saves the model state on Lightning checkpoint saves. |