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
{{ message }}
Repository navigation
funasr_onnx: Fsmn_vad_online raises UnboundLocalError when a chunk produces no feature frames (e.g. 10-30 ms chunks) #3821
Fsmn_vad_online.__call__ (runtime/python/onnxruntime/funasr_onnx/vad_bin.py) assigns vad_scorer only inside if feats.size != 0:, but always runs param_dict.update({"frontend": frontend, "vad_scorer": vad_scorer}) afterwards. When WavFrontendOnline.extract_fbank returns no feature frames for a call, it raises:
UnboundLocalError: cannot access local variable 'vad_scorer' where it is not associated with a value
This happens on the first call when the first chunk is shorter than 720 samples (45 ms at 16 kHz), so streaming 10, 20 or 30 ms chunks fails at once. It also happens on a later call whose chunk completes no new feature frame, for example a 40-sample packet after 100 ms chunks. The README's 100 ms chunks are not affected, and the failing path never reaches the ONNX session.
Repro: run the streaming example for Fsmn_vad_online with step = 320 (20 ms) instead of 1600. The first model(audio_in=..., param_dict=param_dict) call raises the error above.
It came in with #2528, which moved the scorer into param_dict; before that, a call without features returned [].
For Fsmn_vad_online, a call that produces no feature frames now keeps its frontend/scorer state and returns [] instead of raising UnboundLocalError. The fix also covers short first-and-final streams and empty final flushes after partial chunks, resetting terminal state so a reused param_dict does not carry the previous stream's cache into the next one.
The release passed exact-head/main CI; official PyPI wheel/sdist downloads match the tested GitHub assets. Runtime evidence includes byte-matched CPU and real L20Z synthetic boundary tests, not pretrained VAD accuracy or a full-suite claim. This addresses the VAD wrapper; the separately noted streaming Paraformer short-first-chunk handling is not part of #3822.
Activity
LauraGPT commentedon Nov 2, 2026
The #3822 fix is now published in standalone
funasr-onnx0.4.4 (2026-11-02). Upgrading only the rootfunasrpackage does not replace this wrapper:For
Fsmn_vad_online, a call that produces no feature frames now keeps its frontend/scorer state and returns[]instead of raisingUnboundLocalError. The fix also covers short first-and-final streams and empty final flushes after partial chunks, resetting terminal state so a reusedparam_dictdoes not carry the previous stream's cache into the next one.The release passed exact-head/main CI; official PyPI wheel/sdist downloads match the tested GitHub assets. Runtime evidence includes byte-matched CPU and real L20Z synthetic boundary tests, not pretrained VAD accuracy or a full-suite claim. This addresses the VAD wrapper; the separately noted streaming Paraformer short-first-chunk handling is not part of #3822.