Skip to content

fix(onnx): handle empty and short inputs in offline VAD - #3846

Merged
LauraGPT merged 1 commit into
modelscope:mainfrom
BillVan1945:fix/onnx-vad-short-input
Nov 6, 2026
Merged

LauraGPT merged 1 commit into
modelscope:mainfrom
BillVan1945:fix/onnx-vad-short-input

Conversation

@BillVan1945

@BillVan1945 BillVan1945 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Offline Fsmn_vad crashes on empty audio or recordings shorter than one analysis window. The frontend produces no feature frames, but LFR still reads the first frame, raising IndexError. In a file list, this also interrupts processing of the remaining files.

Check the actual fbank frame count before applying LFR. For zero-frame inputs, return correctly shaped empty features and skip inference. Each input keeps its empty segment list, and processing continues with the next file.

Type of change

  • Bug fix
  • Documentation
  • Example or demo
  • Runtime or deployment
  • Benchmark or evaluation
  • Model/training change

Validation

Extended the existing offline VAD tests to cover empty/short inputs, analysis-window boundaries and mixed short/normal file lists. Tests verify result order, unchanged normal-audio segments and no inference calls for zero-frame inputs.

Offline/streaming VAD regressions and installed-package checks pass. Tests use the real frontend and VAD state machine with mocked neural inference.

  • python -m compileall funasr examples tests
  • Docs or links checked
  • Runtime/deployment command tested (installed-package regression tests)

User impact

Empty or very short recordings return an empty segment list instead of aborting the call, including when mixed with normal recordings.

Notes for reviewers

The check follows the frontend configuration rather than a fixed sample count. Changes are limited to offline Fsmn_vad and its existing tests; the shared frontend and streaming VAD are unchanged.

@LauraGPT LauraGPT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed both changed files at f2dfafb3848b19e13eae5e1a9f51bb682903c40e against current main 57485f744e445898cdba06d0868468bcc5086f5d. The zero-frame check uses the actual frontend length, preserves an empty independent result at each short-input position, and leaves normal LFR/scoring unchanged. The feature shape and dtype are preserved when bypassing LFR.

Maintainer validation:

  • The submitted short-input regression fails on unchanged main; the failure log is retained.
  • 77 selected installed-wheel CPU/package tests pass on the combined current-main tree.
  • 87 newly executed L20Z/CUDA FP32 cases pass: empty/sub-frame/boundary audio, paths/arrays, mixed file lists, requested batch sizes 1/2/3 (effective batch 1), exact result ownership and inference-call counts. Actual profiles contain CUDA nodes and no CPU node fallback. This uses the existing analytic ONNX scoring/cache fixture plus real wrapper/frontend/VAD state machine, not pretrained weights or ASR-quality/full-suite validation.
  • Exact-head CI logs and downloaded wheel/sdist/runtime artifacts were inspected, including actual package source bytes and source-commit markers. No CI rerun.

This is a source fix. Existing published funasr-onnx 0.4.8 is not overwritten; package delivery requires a new version. No protection bypass or approval-policy change.

@LauraGPT
LauraGPT merged commit d8e6766 into modelscope:main Nov 6, 2026
4 checks passed
LauraGPT added a commit that referenced this pull request Nov 6, 2026
Publish the already accepted #3846/#3847 standalone wrapper fixes with hosted regression coverage.

Signed-off-by: LauraGPT <zhifu.gzf@alibaba-inc.com>
LauraGPT added a commit that referenced this pull request Nov 6, 2026
Accept tested standalone package bytes and the already accepted exact-source #3846/#3847 runtime evidence.

Signed-off-by: LauraGPT <zhifu.gzf@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants