callcut.pipeline.save_pipeline🔗

callcut.pipeline.save_pipeline(model, extractor, decoder, fname, *, overwrite=False)[source]🔗

Save a complete pipeline to a file.

Saves the model architecture, trained weights, feature extractor configuration, and decoder configuration. The resulting file is self-contained: load_pipeline() can reconstruct all components without additional information.

Parameters:
modelBaseDetector

The trained model.

extractorBaseExtractor

Feature extractor used with this model.

decoderBaseDecoder

Decoder for converting probabilities to intervals.

fnamestr | Path

Path to save the pipeline. Conventionally use .pt extension.

overwritebool

If True, overwrite the file if it exists.

See also

load_pipeline

Load a pipeline from a file.

Examples

>>> from callcut.extractors import SNRExtractor
>>> from callcut.nn import TinySegCNN
>>> from callcut.evaluation import HysteresisDecoder
>>> from callcut.pipeline import save_pipeline
>>>
>>> extractor = SNRExtractor(sample_rate=32000, hop_ms=8.0, n_bands=8)
>>> model = TinySegCNN(n_bands=8, window_frames=250)
>>> decoder = HysteresisDecoder()
>>> save_pipeline(model, extractor, decoder, "pipeline.pt")