BaseTrainer
- class neuralhydrology.training.basetrainer.BaseTrainer(cfg: Config)
Bases:
object
Default class to train a model.
- Parameters:
cfg (Config) – The run configuration.
- initialize_training()
Initialize the training class.
This method will load the model, initialize loss, regularization, optimizer, dataset and dataloader, tensorboard logging, and Tester class. If called in a
continue_training
context, this model will also restore the model and optimizer state.
- train_and_validate()
Train and validate the model.
Train the model for the number of epochs specified in the run configuration, and perform validation after every
validate_every
epochs. Model and optimizer state are saved after everysave_weights_every
epochs.