Repository navigation
fix(auto-model): preserve the resampled rate for speaker inference - #3763
Conversation
LauraGPT
left a comment
There was a problem hiding this comment.
Reviewed 74bb9b50e26ad81667f04b098f8d4a40aef32bb6. No blocking correctness issue found in the changed speaker-inference boundary.
I independently reproduced the new regression matrix against the current main implementation (66d7a4c): 21 failed / 8 passed. With the PR implementation, the PCM/input conversion, byte loading and submodel configuration checks passed 106 tests, including all 29 new speaker cases; the API signature checks passed another 6 tests. Four unittest subtests also passed. The initial signature setup errors were missing files in my review export; restoring the exact generator and CSS from the reviewed commit resolved them without changing the PR or tests.
The one-line override uses the rate of the waveform already loaded for VAD/ASR, and matches the existing ASR call. The tests exercise real conversion, resampling and CAMPPlus preprocessing orchestration, including constructor/per-call precedence and preservation of caller-owned configuration. This validates the 16 kHz segment path with non-16 kHz source input. It does not measure acoustic recognition or diarization quality, accelerator execution, or arbitrary frontend rates.
Validation ran on Linux, Python 3.12, NumPy 1.26 and CPU Torch, with model downloads disabled. This is source-level review evidence; no package release or full inference evaluation was performed.
LauraGPT
left a comment
There was a problem hiding this comment.
The resampled speaker boundary and independent regression results are covered in review #5451919683. After approving the held fork workflows, MOSS, KWS and both NumPy compatibility lanes have completed successfully.
Summary
When
generate(..., fs=8000)orfs=48000runs with VAD and a speaker model, speaker inference receives the original source rate even though its input segments have already been resampled. CAMPPlus then resamples them a second time. A padded 1.5-second, 16 kHz segment contains 24,000 samples; passingfs=48000changes it to 8,000 samples before feature extraction.Pass the actual segment rate to speaker inference, matching the existing ASR boundary. Add regressions for arrays and explicit PCM, single and batched inputs, constructor/per-call precedence, conflicting speaker configuration, subsequent default calls, and caller-owned config preservation. This completes the speaker boundary left outside the VAD→ASR rate fix in #3751.
Related issue: #3762
Type of change
Validation
66d7a4c264a5993a2a63ed00c1f402c296ee521a21 failed / 8 passed; fixed source 29 passed.AutoModel.generate→ CAMPPlus reproduction: 8,000 samples before / 24,000 samples after for a 48 kHz source.python -m compileall funasr examples testsE9,F63,F7,F82) andgit diff --checkpass./proc/self/staton macOS, and an existing frontend STFT path reportsWindow size mismatch: 512 != 400. No checks were skipped or dependency declarations changed to bypass them.python -m build --no-isolation: sdist and wheel built successfully; the packagedauto_model.pyin both archives matches the tested fixed file byte-for-byte.User impact
Preserves the waveform duration and content entering speaker feature extraction when callers provide non-16 kHz source audio, or when speaker config contains a conflicting source rate.
Notes for reviewers
Production change is one line. Tests use synthetic 440 Hz waves or silence and lightweight VAD/ASR/embedding stand-ins, with real input conversion/resampling, VAD slicing, speaker chunking, and CAMPPlus inference orchestration. The matrix captures the feature boundary; the constructor/config test also runs real speaker feature extraction. No weights are downloaded. Acoustic recognition quality, diarization quality, accelerator execution and arbitrary ASR frontend rates were not evaluated. Tested frontend rate is 16 kHz.
Prepared with AI assistance; all stated local results are from the current source checkout.