batdetect2/docs/source/reference/configs/training/training-config.md
2026-08-08 12:18:55 +01:00

1.9 KiB

Training config reference

TrainingConfig controls the training loop, optimisation, data loading, losses, and validation tasks.

Defined in batdetect2.train.config.

Top-level fields

  • compile_model
    • compile the detector before training starts. This is off by default.
  • precision
    • optional float32 matrix multiplication precision setting passed to PyTorch.
  • train_loader
    • training data loading and clipping settings.
  • val_loader
    • validation data loading and clipping settings.
  • optimizer
    • optimiser type and learning rate settings.
  • scheduler
    • learning-rate schedule settings.
  • loss
    • detection, classification, and size loss settings.
  • trainer
    • PyTorch Lightning trainer settings such as max_epochs.
  • labels
    • target label generation settings.
  • validation
    • evaluation tasks used during validation.
  • checkpoints
    • checkpoint saving settings.

What this config controls

Use TrainingConfig when you want to change things like:

  • batch size,
  • augmentation,
  • optimiser and scheduler settings,
  • runtime options such as model compilation and matrix multiplication precision,
  • number of epochs,
  • validation frequency,
  • checkpoint behaviour.

Runtime options

Use compile_model: true to call torch.compile on the detector used during training. This can help on longer runs with stable tensor shapes, but it may be slower for short CPU-only experiments because PyTorch has to compile the graph before it can reuse it.

Use precision to set PyTorch's float32 matrix multiplication precision before training starts. Supported values are medium and high.

Example files live under example_data/configs/, including example_data/configs/training.yaml.

  • Evaluation config: {doc}../evaluation/evaluation-config
  • Train command reference: {doc}../../cli/train
  • Fine-tune from a checkpoint: {doc}../../../how_to/training/fine-tune-from-a-checkpoint