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:
- model
BaseDetector The trained model.
- extractor
BaseExtractor Feature extractor used with this model.
- decoder
BaseDecoder Decoder for converting probabilities to intervals.
- fname
str|Path Path to save the pipeline. Conventionally use
.ptextension.- overwrite
bool If
True, overwrite the file if it exists.
- model
See also
load_pipelineLoad 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")