cvrunner.experiment package
Submodules
cvrunner.experiment.experiment module
- class cvrunner.experiment.experiment.BaseExperiment
Bases:
ABCTemplate for the configuration. Every experiments should be stateless.
- property batch_size: int
Returns: int: batch size
- abstractmethod build_criterion(*args, **kwargs)
Criterion building logic
- Returns:
callable criterion
- Return type:
Callable
- abstractmethod build_dataloader(partition)
Dataloader building logic
- Parameters:
partition (str) – should be in [‘train’, ‘val’]
- Return type:
DataLoader
- abstractmethod build_dataset(partition)
Dataset building logic
- Parameters:
partition (str) – should be in [‘train’, ‘val’]
- Return type:
Dataset
- abstractmethod build_loss_function()
Loss function building logic
- Returns:
callable loss function
- Return type:
Any
- abstractmethod build_model()
Model building logic
- Return type:
torch.nn.Module
- abstractmethod build_optimizer_scheduler(model)
Optimizer and Learning scheduler building logic
- Parameters:
model (torch.nn.Module) – model to be trained
- Return type:
Tuple[Optimizer, _LRScheduler]
- abstractmethod load_checkpoint(file_path)
_summary_
- Parameters:
file_path (str) – checkpoint point file
- Return type:
torch.nn.Module
- property num_epochs: int
Returns: int: num epochs
- property random_seed: int
Random seed for experiment
- Returns:
Random seed
- Return type:
int
- abstractmethod runner_cls()
Define type of runner to run this experiment
- Returns:
runner class
- Return type:
BaseRunner
- abstractmethod save_checkpoint()
Checkpointing logic
- Return type:
None
- train_epoch_end()
Train epoch ending methods
- Return type:
None
- train_epoch_start()
Train epoch startiting methods
- Return type:
None
- train_step(model, data_batch, loss_function, optimizer, lr_scheduler, device)
Train step logic
- Parameters:
model (torch.nn.Module) – model to be trained
data_batch (DataBatch) – data to train
loss_function (torch.nn.Module) – loss function
optimizer (Optimizer)
lr_scheduler (_LRScheduler)
- Return type:
Dict[str,Any]
- val_epoch_end()
Validation epoch ending logic
- Return type:
None
- val_epoch_start()
Validation epoch startining methods
- Return type:
None
- property val_freq: int
Returns: int: validation frequency
- val_step(model, data_batch, loss_function, criterion, device)
validation step logic
- Parameters:
model (torch.nn.Module)
data_batch (DataBatch)
loss_function (torch.nn.Module)
criterion (torch.nn.Module)
- Return type:
Dict[str,Any]
- property wandb_project: str
- property wandb_runname: None | str