mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-08-22 03:00:10 +02:00
docs: document runtime compilation options
This commit is contained in:
parent
bad5d4f4fc
commit
c8f0f2bee1
@ -15,6 +15,9 @@ Defined in `batdetect2.api_v2`.
|
|||||||
- `BatDetect2API.from_config(model_config=..., targets_config=..., ...)`
|
- `BatDetect2API.from_config(model_config=..., targets_config=..., ...)`
|
||||||
- build a full model stack from config objects.
|
- build a full model stack from config objects.
|
||||||
|
|
||||||
|
Both constructors accept `compile_model=True` to compile the detector after the
|
||||||
|
API is built.
|
||||||
|
|
||||||
## Common tasks
|
## Common tasks
|
||||||
|
|
||||||
- Load a checkpoint and run prediction on one file.
|
- Load a checkpoint and run prediction on one file.
|
||||||
@ -22,6 +25,8 @@ Defined in `batdetect2.api_v2`.
|
|||||||
- Save predictions in one of the supported output formats.
|
- Save predictions in one of the supported output formats.
|
||||||
- Evaluate a model on labelled data.
|
- Evaluate a model on labelled data.
|
||||||
- Fine-tune an existing checkpoint on new targets.
|
- Fine-tune an existing checkpoint on new targets.
|
||||||
|
- Compile the detector explicitly with `BatDetect2API.compile()` when you want
|
||||||
|
to opt into PyTorch runtime compilation from Python.
|
||||||
|
|
||||||
## Generated reference
|
## Generated reference
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,8 @@ Defined in `batdetect2.inference.config`.
|
|||||||
|
|
||||||
## Top-level fields
|
## Top-level fields
|
||||||
|
|
||||||
|
- `compile_model`
|
||||||
|
- compile the detector before batch prediction. This is off by default.
|
||||||
- `loader`
|
- `loader`
|
||||||
- data-loader settings for inference.
|
- data-loader settings for inference.
|
||||||
- `clipping`
|
- `clipping`
|
||||||
@ -34,8 +36,19 @@ Override `InferenceConfig` when:
|
|||||||
|
|
||||||
- long recordings need different clipping behavior,
|
- long recordings need different clipping behavior,
|
||||||
- you want to tune batch size for your hardware,
|
- you want to tune batch size for your hardware,
|
||||||
|
- you want to opt into runtime model compilation for repeated predictions,
|
||||||
- you need reproducible prediction settings across runs.
|
- you need reproducible prediction settings across runs.
|
||||||
|
|
||||||
|
## Runtime compilation
|
||||||
|
|
||||||
|
Set `compile_model: true` to compile the detector before batch inference. This
|
||||||
|
can help when you run repeated predictions with stable input shapes. For a
|
||||||
|
single short run, the compile step can cost more time than it saves.
|
||||||
|
|
||||||
|
In Python, you can also compile explicitly with `BatDetect2API.compile()` or by
|
||||||
|
passing `compile_model=True` to `BatDetect2API.from_checkpoint(...)` or
|
||||||
|
`BatDetect2API.from_config(...)`.
|
||||||
|
|
||||||
## Related pages
|
## Related pages
|
||||||
|
|
||||||
- Tune inference clipping:
|
- Tune inference clipping:
|
||||||
|
|||||||
@ -7,6 +7,10 @@ Defined in `batdetect2.train.config`.
|
|||||||
|
|
||||||
## Top-level fields
|
## 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`
|
- `train_loader`
|
||||||
- training data loading and clipping settings.
|
- training data loading and clipping settings.
|
||||||
- `val_loader`
|
- `val_loader`
|
||||||
@ -33,10 +37,22 @@ Use `TrainingConfig` when you want to change things like:
|
|||||||
- batch size,
|
- batch size,
|
||||||
- augmentation,
|
- augmentation,
|
||||||
- optimiser and scheduler settings,
|
- optimiser and scheduler settings,
|
||||||
|
- runtime options such as model compilation and matrix multiplication
|
||||||
|
precision,
|
||||||
- number of epochs,
|
- number of epochs,
|
||||||
- validation frequency,
|
- validation frequency,
|
||||||
- checkpoint behaviour.
|
- 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 files live under `example_data/configs/`, including
|
||||||
`example_data/configs/training.yaml`.
|
`example_data/configs/training.yaml`.
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,9 @@ class BatDetect2API:
|
|||||||
Training logger config override.
|
Training logger config override.
|
||||||
logging_callbacks : Sequence[LoggingCallback[TrainLoggingContext]], optional
|
logging_callbacks : Sequence[LoggingCallback[TrainLoggingContext]], optional
|
||||||
Extra logging callbacks to run during training setup.
|
Extra logging callbacks to run during training setup.
|
||||||
|
train_logger : Logger | None, optional
|
||||||
|
Pre-built Lightning logger to use for training. If omitted, one is
|
||||||
|
built from ``logger_config``.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user