trainerERA5_multistep_v1#

Classes#

Trainer

Helper class that provides a standard way to create an ABC using

Module Contents#

class trainerERA5_multistep_v1.Trainer(model: torch.nn.Module, rank: int)#

Bases: credit.trainers.base_trainer.BaseTrainer

Helper class that provides a standard way to create an ABC using inheritance.

train_one_epoch(epoch, conf, trainloader, optimizer, criterion, scaler, scheduler, metrics, forecast_length=0)#
validate(epoch, conf, valid_loader, criterion, metrics)#
fit(conf, train_loader, valid_loader, optimizer, train_criterion, valid_criterion, scaler, scheduler, metrics, rollout_scheduler=None, trial=False)#

Run the full training loop.

Parameters:
  • conf – Full configuration dict (passed through to train_one_epoch/validate for data-related settings; trainer settings are accessed via self).

  • train_loader – DataLoaders.

  • valid_loader – DataLoaders.

  • optimizer – Training objects.

  • train_criterion – Training objects.

  • valid_criterion – Training objects.

  • scaler – Training objects.

  • scheduler – Training objects.

  • metrics – Training objects.

  • rollout_scheduler – Optional callable to schedule rollout probability.

  • trial – Optuna trial object, or False.

Returns:

Dict with the best epoch’s results.