soft.crisp.offline package
Submodules
soft.crisp.offline.supervised module
Implements supervised training and can be used for auto-encoder training as well.
- soft.crisp.offline.supervised.setup_from_config(config: ~YACS.yacs.Config) -> (<class 'torch.nn.modules.module.Module'>, <class 'torch.optim.optimizer.Optimizer'>)
Given a configuration, load the necessary loss functions and optimizers accordingly. :param config: The configuration to use.
- Returns:
loss_function, optimizer
- soft.crisp.offline.supervised.train(train_dataset: SupervisedDataset, val_dataset: SupervisedDataset, model: Module, config: Config | None = None) Tuple[Module, History]
Train the model given the training dataset and validation dataset, using a configuration (config).
- Parameters:
train_dataset – Dataset for training.
val_dataset – Dataset for validation.
model – The PyTorch model to be trained.
config – The configuration to use.
- Returns:
model, losses [dictionary where keys are ‘train’ and ‘val’ for training losses (list), validation losses (list), respectively]