vak.config.train.TrainConfig#
- class vak.config.train.TrainConfig(model, num_epochs, batch_size, root_results_dir, dataset_path=None, results_dirname=None, normalize_spectrograms=False, num_workers=2, device='cpu', shuffle=True, val_step=None, ckpt_step=None, patience=None, checkpoint_path=None, spect_scaler_path=None, train_transform_params=None, train_dataset_params=None, val_transform_params=None, val_dataset_params=None)[source]#
Bases:
object
class that represents [TRAIN] section of config.toml file
- num_epochs#
number of training epochs. One epoch = one iteration through the entire training set.
- Type:
- root_results_dir#
directory in which results will be created. The vak.cli.train function will create a subdirectory in this directory each time it runs.
- Type:
- num_workers#
Number of processes to use for parallel loading of data. Argument to torch.DataLoader.
- Type:
- device#
Device on which to work with model + data. Defaults to ‘cuda’ if torch.cuda.is_available is True.
- Type:
- normalize_spectrograms#
if True, use spect.utils.data.SpectScaler to normalize the spectrograms. Normalization is done by subtracting off the mean for each frequency bin of the training set and then dividing by the std for that frequency bin. This same normalization is then applied to validation + test data.
- Type:
- val_step#
Step on which to estimate accuracy using validation set. If val_step is n, then validation is carried out every time the global step / n is a whole number, i.e., when val_step modulo the global step is 0. Default is None, in which case no validation is done.
- Type:
- ckpt_step#
Step on which to save to checkpoint file. If ckpt_step is n, then a checkpoint is saved every time the global step / n is a whole number, i.e., when ckpt_step modulo the global step is 0. Default is None, in which case checkpoint is only saved at the last epoch.
- Type:
- patience#
number of validation steps to wait without performance on the validation set improving before stopping the training. Default is None, in which case training only stops after the specified number of epochs.
- Type:
- checkpoint_path#
path to directory with checkpoint files saved by Torch, to reload model. Default is None, in which case a new model is initialized.
- Type:
- spect_scaler_path#
path to a saved SpectScaler object used to normalize spectrograms. If spectrograms were normalized and this is not provided, will give incorrect results. Default is None.
- Type:
- __init__(model, num_epochs, batch_size, root_results_dir, dataset_path=None, results_dirname=None, normalize_spectrograms=False, num_workers=2, device='cpu', shuffle=True, val_step=None, ckpt_step=None, patience=None, checkpoint_path=None, spect_scaler_path=None, train_transform_params=None, train_dataset_params=None, val_transform_params=None, val_dataset_params=None) None #
Method generated by attrs for class TrainConfig.
Methods
__init__
(model, num_epochs, batch_size, ...)Method generated by attrs for class TrainConfig.