Training configuration¶
Training configuration lives under the Trainer root object.
Trainer:
Model:
classpath: segmentation.UNet.UNet
UNet:
...
Dataset:
...
train_name: SEG_BASELINE
epochs: 100
Top-level fields¶
Field |
Type |
Default in code |
Required |
Effect |
|---|---|---|---|---|
|
mapping |
|
Yes |
Selects and configures the model graph. |
|
mapping |
|
Yes |
Defines training data loading, transforms, augmentation, and patching. |
|
string |
|
No |
Names the run and its output folders. |
|
int or null |
|
No |
Sets the random seed when provided. |
|
int |
|
No |
Number of training epochs. |
|
int or null |
|
No |
Validation and checkpoint interval in iterations. |
|
bool |
|
No |
Enables AMP during training. |
|
list or null |
|
No |
Activates gradient checkpointing on selected modules. |
|
list or null |
|
No |
Pins selected modules to dedicated GPUs. |
|
float |
|
No |
Enables exponential moving average tracking when greater than zero. |
|
list or null |
|
No |
TensorBoard logging directives for dataset groups or model outputs. |
|
mapping or null |
|
No |
Configures early stopping. |
|
string |
|
No |
|
Trainer.Model¶
Trainer.Model always starts with a classpath, then a section named after the
selected class.
Model:
classpath: segmentation.UNet.UNet
UNet:
optimizer:
name: AdamW
lr: 0.001
Common nested fields used by built-in and local models:
Field |
Type |
Required |
Effect |
|---|---|---|---|
|
string |
Yes |
Selects the model class to import. |
|
mapping |
Yes |
Constructor arguments for the chosen class. |
|
mapping |
Usually |
Optimizer configuration passed through |
|
mapping |
Optional |
Learning-rate schedulers keyed by classpath. |
|
mapping |
Usually |
Declares losses and metrics attached to specific model outputs. |
|
mapping |
Optional |
Enables model-level patching via |
|
int |
Model-dependent |
Declares whether the network operates in 2D or 3D. |
outputs_criterions¶
This is the most important training structure after the dataset definition.
outputs_criterions:
UNetBlock_0:Head:Conv:
targets_criterions:
SEG:
criterions_loader:
torch:nn:CrossEntropyLoss:
is_loss: true
schedulers:
Constant:
nb_step: 0
value: 1
Structure:
output key → model output or module path
targets_criterions→ one or more target groupscriterions_loader→ one or more criteria for that targeteach criterion can define
is_loss,group,start,stop,accumulation, and scheduler weights
Trainer.Dataset¶
Training datasets are instantiated through DataTrain.
Common fields:
Field |
Type |
Default in code |
Effect |
|---|---|---|---|
|
list[str] |
|
Dataset sources and selection mode. |
|
mapping |
required in practice |
Maps on-disk groups to loaded tensors. |
|
mapping or null |
one default augmentation list |
Data augmentations sampled during training. |
|
bool |
|
Keeps base samples cached and generates augmentation tensors only when an augmented sample is requested; augmentation states are re-sampled on each epoch. |
|
mapping or null |
|
Dataset-level patch extraction. |
|
bool |
|
Cache transformed data in memory. |
|
object |
|
Restricts which cases are used. |
|
int |
|
Batch size. |
|
int or null |
|
Number of DataLoader workers. When |
|
bool |
|
Enables pinned host memory for DataLoader batches. |
|
int or null |
|
Number of prefetched batches per worker when workers are enabled. |
|
bool or null |
|
Keep workers alive across epochs when workers are enabled. |
|
float / string / list / null |
|
Validation split or explicit validation set. |
|
bool |
|
Shuffles the training sampler. |
When use_cache: false, KonfAI now tries to stream patches directly from disk instead of materializing full volumes in RAM. This path is used automatically when the configured preprocessing chain is compatible with patch-wise loading; otherwise KonfAI falls back to the existing full-volume loading path.
groups_src¶
Each source group contains one or more destination groups:
groups_src:
CT:
groups_dest:
CT:
transforms:
Standardize:
lazy: false
mean: None
std: None
mask: None
inverse: false
patch_transforms: None
is_input: true
Use this section to define:
what exists on disk
preprocessing transforms
patch-specific transforms
whether the tensor is a model input
Examples¶
The most practical examples in the repository are:
examples/Segmentation/Config.ymlexamples/Synthesis/Config.ymlexamples/Synthesis/Config_GAN.yml