Runs any HuggingFace audio-classification checkpoint on each AudioFrame; emits ranked [Classification], a top Classification, or the top label as String. Sigmoid (multi-label) vs softmax (single-label) is auto-picked per checkpoint.
Typical backends
Tag recorded audio with AudioSet event labels (AST, CED, DASS) and route on the predicted event through a conditional branch.
Classify live microphone audio and log the predicted events for monitoring.
Caveats
- State lifetimeThe model id is watched at runtime and hot-swapped in place when changed, clearing the GPU cache on swap, so switching checkpoints needs no restart; the device, top_k, activation override and access token are captured at startup.
- FallbackA device set to a CUDA value silently falls back to CPU when no GPU is present, and any CUDA index resolves to GPU 0 rather than the suffix you name.
- AccuracyThe activation defaults to auto, picking independent sigmoid scores for multi-label checkpoints (declared as such, or an AudioSet-scale label space when undeclared) and a competing softmax distribution for single-label checkpoints; force it with the multi_label override when a checkpoint is mislabelled. The label vocabulary follows the chosen checkpoint.
- I/O contractAudio is resampled to the rate the loaded feature extractor expects, so the upstream sample rate may differ from the checkpoint's native rate.
- I/O contractAn empty
AudioFrame returns an empty result without running the model, so downstream consumers must handle the empty case.