mixmo.learners.abstract_learner.AbstractLearner

class mixmo.learners.abstract_learner.AbstractLearner(config_args, dloader, device)[source]

Bases: object

Base learner class that groups models, optimizers and loggers Performs the entire model building, training and evaluating process

__init__(config_args, dloader, device)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(config_args, dloader, device)

Initialize self.

evaluate(inference_loader[, split])

Perform an evaluation of the model

evaluate_loop(dloader, verbose, **kwargs)

load_checkpoint(checkpoint[, …])

Load checkpoint (and optimizer if included) to the wrapped model

save_checkpoint(epoch[, save_path])

Save model (and optimizer) state dict

save_tb(logs_dict, epoch)

Write stats from logs_dict at epoch to the Tensoboard summary writer

train(epoch)

Train for one epoch

train_loop(epoch)

Attributes

tb_logger

Get (or initialize) the Tensorboard SummaryWriter

_create_model_wrapper()[source]

Initialize the model along with other elements through a ModelWrapper

evaluate(inference_loader, split='test')[source]

Perform an evaluation of the model

load_checkpoint(checkpoint, include_optimizer=True, return_epoch=False)[source]

Load checkpoint (and optimizer if included) to the wrapped model

save_checkpoint(epoch, save_path=None)[source]

Save model (and optimizer) state dict

save_tb(logs_dict, epoch)[source]

Write stats from logs_dict at epoch to the Tensoboard summary writer

property tb_logger

Get (or initialize) the Tensorboard SummaryWriter

train(epoch)[source]

Train for one epoch