src.training ¶
Functions:
| Name | Description |
|---|---|
get_data_loader | Get the training and testing data loaders. |
get_datasets | Load and return the training and testing datasets. |
test | Test a model. |
train_epoch | Train a model for one epoch. |
Functions¶
get_data_loader ¶
get_data_loader(batch_size: int) -> tuple[DataLoader, DataLoader]
Get the training and testing data loaders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| int | batch size | required |
Returns:
| Type | Description |
|---|---|
tuple[DataLoader, DataLoader] | Tuple[DataLoader, DataLoader]: training and testing data loaders |
Source code in src/training.py
get_datasets ¶
get_datasets() -> tuple[Dataset, Dataset]
Load and return the training and testing datasets.
Returns:
| Type | Description |
|---|---|
tuple[Dataset, Dataset] | Tuple[Dataset, Dataset]: training and testing datasets |
Source code in src/training.py
test ¶
Test a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Config | training configuration and logging handle | required |
| Module | model to test | required |
| DataLoader | testing data loader | required |
| int | current epoch | required |
Returns:
| Type | Description |
|---|---|
dict[str, float] | Dict[str, float]: calculated metrics |
Source code in src/training.py
train_epoch ¶
train_epoch(config: Config, model: Module, train_loader: DataLoader, optimizer: Optimizer, epoch: int)
Train a model for one epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Config | training configuration and logging handle | required |
| Module | model to train | required |
| DataLoader | training data loader | required |
| Optimizer | training optimizer | required |
| int | current epoch | required |