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

model#

Model name, e.g., model = "TweetyNet"

Type:

str

dataset_path#

Path to dataset, e.g., a csv file generated by running vak prep.

Type:

str

num_epochs#

number of training epochs. One epoch = one iteration through the entire training set.

Type:

int

batch_size#

number of samples per batch presented to models during training.

Type:

int

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:

str

num_workers#

Number of processes to use for parallel loading of data. Argument to torch.DataLoader.

Type:

int

device#

Device on which to work with model + data. Defaults to ‘cuda’ if torch.cuda.is_available is True.

Type:

str

shuffle#

if True, shuffle training data before each epoch. Default is True.

Type:

bool

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:

bool

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:

int

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:

int

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:

int

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:

str

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:

str

__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.