peal.training.trainers¶
Supervised training loop for PEAL predictors and predictor distillation.
ModelTrainer trains a classifier (or a generator exposing
track_generator_performance) from a PredictorConfig: it builds the
model, dataloaders, optimizer, criterions and TensorBoard logger, runs epochs
with optional mixup, label smoothing and PGD adversarial training, applies an
early-stopping/regularisation scheme and writes model.cpl,
checkpoints/*.cpl and config.yaml into model_path. The
distill_* helpers relabel datasets with a teacher predictor’s outputs and
train a student on them, which is how CFKD/DiDAE turn a repaired predictor
into a stand-alone model. calculate_test_accuracy() is the shared
(worst-)group accuracy evaluator.
Functions
Compute the accuracy of |
|
Relabel |
|
Relabel |
|
Recursively relabel every loader inside a |
|
Train a student predictor on data relabelled by |
|
Instantiate the predictor described by a |
|
First checkpoint in paths that actually loads, or None if none does. |
|
Mix each sample with a random partner (Zhang et al. mixup). |
Classes
Train a predictor from a |