peal.training.interfaces.TrainingConfig

class peal.training.interfaces.TrainingConfig[source]

Bases: BaseModel

Hyper-parameters and switches of one predictor training run.

Besides max_epochs, learning_rate, dropout, optimizer and the three batch sizes, the config holds the ModelTrainer switches for adversarial training (adv_training, attack_epsilon, attack_num_steps, input_noise_std), mixup and label smoothing, class balancing, diffusion-based augmentation (diffusion_augmented with sampling_time_fraction / num_discretization_steps) and the early_stopping_goal metric the best checkpoint is picked by. steps_per_epoch enables the DataloaderMixer episode length; epoch, global_train_step and global_validation_step are counters the trainer and logger increment during training.

Methods

Attributes

adv_training

attack_epsilon

attack_num_steps

class_balanced

concatenate_batches

diffusion_augmented

dropout

The dropout rate the model is trained with.

early_stopping_goal

epoch

The current epoch of the model training.

global_train_step

Logs how many steps the model was trained with already.

global_validation_step

Logs how many steps the model was validated for.

input_noise_std

label_smoothing

learning_rate

The learning rate the model is trained with.

max_epochs

The learning rate the model is trained with.

mixup_alpha

no_grad_attack

num_discretization_steps

num_noise_vec

num_workers

DataLoader worker processes for the loaders built from this config.

optimizer

The optimizer used for training the model.

regulization_level

sampling_time_fraction

steps_per_epoch

The number of iterations per episode when using DataloaderMixer.

test_batch_size

The test batch size.

train_batch_size

The train batch size.

train_on_test

use_mixup

val_batch_size

The val batch size.

max_epochs: pydantic.PositiveInt = 15

The learning rate the model is trained with.

learning_rate: float = 0.0001

The learning rate the model is trained with.

dropout: float = 0.5

The dropout rate the model is trained with.

num_workers: int = 0

DataLoader worker processes for the loaders built from this config. 0 keeps loading in the training process (the historical behaviour); see peal.data.dataloaders.resolve_num_workers for the $PEAL_NUM_WORKERS override and the reason the default is conservative.

global_train_step: int = 0

Logs how many steps the model was trained with already.

global_validation_step: int = 0

Logs how many steps the model was validated for.

epoch: int = -1

The current epoch of the model training.

optimizer: str = 'Adam'

The optimizer used for training the model.

train_batch_size: pydantic.PositiveInt = 1

The train batch size. Can either be set manually or be left empty and calculated by adaptive batch_size.

val_batch_size: pydantic.PositiveInt = 1

The val batch size. Can either be set manually or be left empty and calculated by adaptive batch_size.

test_batch_size: pydantic.PositiveInt = 1

The test batch size. Can either be set manually or be left empty and calculated by adaptive batch_size.

steps_per_epoch: None | pydantic.PositiveInt = None

The number of iterations per episode when using DataloaderMixer. If it is not set, the DataloaderMixer is not used and the value implicitly becomes dataset_size / batch_size

concatenate_batches: bool = True
adv_training: bool = False
input_noise_std: float = 0.1
num_noise_vec: int = 1
no_grad_attack: bool = False
attack_epsilon: float = 1.0
attack_num_steps: int = 5
train_on_test: bool = False
class_balanced: bool = False
use_mixup: bool = False
mixup_alpha: float = 1.0
label_smoothing: float = 0.0
early_stopping_goal: str = 'average_accuracy'
diffusion_augmented: bool = False
sampling_time_fraction: float = 0.3
num_discretization_steps: int = 20
regulization_level: float = 1.3