lightning_template.utils.loop.kfold#

Classes#

KFoldLoop

Basic Loops interface.

Module Contents#

class lightning_template.utils.loop.kfold.KFoldLoop(num_folds: int, fit_loop: lightning.pytorch.loops._FitLoop = None)#

Bases: lightning.pytorch.loops._Loop

Basic Loops interface.

num_folds#
current_fold = 0#
_export_path = None#
fit_loop = None#
lightning_module_state_dict = None#
property export_path: str#
property done: bool#
reset() None#

Nothing to reset in this loop.

on_run_start(*args: Any, **kwargs: Any) None#

Used to call setup_folds from the BaseKFoldDataModule instance and store the original weights of the model.

on_advance_start(*args: Any, **kwargs: Any) None#

Used to call setup_fold_index from the BaseKFoldDataModule instance.

advance(*args: Any, **kwargs: Any) None#

Used to the run a fitting and testing on the current hold.

on_advance_end() None#

Used to save the weights of the current fold and reset the LightningModule and its optimizers.

on_save_checkpoint() Dict[str, int]#

Called when saving a model checkpoint, use to persist loop state.

Returns:

The current loop state.

on_load_checkpoint(state_dict: Dict) None#

Called when loading a model checkpoint, use to reload loop state.

_reset_fitting() None#
__getattr__(key) Any#