You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(rp-27 part 2): opt-in second ONNX input orig_sample_rate for raw_audio
Extends PreprocessMethod::RawAudio with pass_orig_sample_rate: bool (default
false). When true, the CPU detect_audio raw-path engine passes a second
ONNX input "orig_sample_rate" [1] int64 alongside the audio tensor.
Models that opt in can implement in-graph fill_highfreq (or any other
data-driven sample-rate behavior) without engine-side mel knowledge.
Wiring:
- PreparedAudioKind::Raw gained pass_orig_sample_rate field; carried from
manifest through prepare_audio_detection into detect_audio_loop_raw.
- session.run dispatches via the named-input form
Vec<(Cow<str>, SessionInputValue)> when the flag is on.
- resolve_classifier_output (the model-load probe at line 292) also needed
the second input — probes with orig_sample_rate=target_sample_rate
(no-op for fill_highfreq).
Manifest schema: [preprocessing] pass_orig_sample_rate=true|false (default
false). Existing perch-v2 + future single-input raw_audio models keep
working unchanged.
Motivation: orca-ecotype-dclde2026-v1 (RP-onboarding-2026-06-01) uses
raw_audio + softmax with the same fill_highfreq requirement as Stage 1.
Engine-side mel fill (RP-27 Part 1) doesn't reach the in-graph mel path,
so Stage 2 needed its own data-driven fix. The exported ONNX wrapper
implements fill_highfreq via sort + dynamic-k gather; the engine just
ships orig_sample_rate so the in-graph mask boundary tracks it.
Stage 2 parity (300 windows, 10 fixtures): top1 prob delta mean 0.027,
median 0.018, max 0.181; argmax flip rate 4.0% (gate 15%). 24 kHz fixture
(no-resample, fill no-op) matches engine bit-exactly because the in-graph
fill is guarded with no_upsample = (orig_sample_rate >= target_sample_rate)
matching upstream PW's `if orig_sr < SR` guard.
Lib tests: types 123 + core 178 + cpu 74 = 375 PASS.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments