Source code for vis4d.engine.callbacks.trainer_state
"""Trainer state for callbacks."""from__future__importannotationsfromtypingimportTypedDictfromtorch.optim.optimizerimportOptimizerfromtorch.utils.dataimportDataLoaderfromtyping_extensionsimportNotRequiredfromvis4d.commonimportTrainingModulefromvis4d.data.typingimportDictDatafromvis4d.engine.optimimportLRSchedulerWrapper
[docs]classTrainerState(TypedDict):"""State of the trainer. Attributes: current_epoch (int): Current epoch. num_epochs (int): Total number of the training epochs. global_step (int): Global step. num_steps (int): Total number of the training steps. train_dataloader (DataLoader[DictData] | None): Training dataloader. num_train_batches (int | None): Number of training batches. test_dataloader (list[DataLoader[DictData]] | None): List of test dataloaders. num_test_batches (list[int] | None): List of number of test batches. optimizers (NotRequired[list[Optimizer]]): List of optimizers. metrics (NotRequired[dict[str, float]]): Metrics for the logging. """current_epoch:intnum_epochs:intglobal_step:intnum_steps:inttrain_dataloader:DataLoader[DictData]|Nonenum_train_batches:int|Nonetest_dataloader:list[DataLoader[DictData]]|Nonenum_test_batches:list[int]|Noneoptimizers:NotRequired[list[Optimizer]]lr_schedulers:NotRequired[list[LRSchedulerWrapper]]metrics:NotRequired[dict[str,float]]train_module:NotRequired[TrainingModule]train_engine:NotRequired[str]