Repository navigation
Conversation
…eaming Paraformer overlap_feats[:, -0:, :] returns every frame instead of none, so with chunk_size=[0, 10, 5] (the streaming example in README and docs) the final chunk re-decodes the previous chunk's features and repeats the last characters. Compute the tail start index explicitly; the same applies to the non-final cache when chunk_size[0] + chunk_size[2] is 0.
ychy7001
force-pushed
the
fix/funasr-onnx-online-zero-left-chunk
branch
from
October 24, 2026 09:24
45c7863 to
c81b11d
Compare
2 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3789.
add_overlap_chunkstored the left context withoverlap_feats[:, -n:, :]. Withn == 0this returns every frame, so withchunk_size=[0, 10, 5](the streaming example in README and docs) the final chunk re-decodes the previous chunk's features and repeats the last characters, e.g. 火爆 → 火爆爆爆.The start index is now computed explicitly in a small
_tail_frameshelper, used for both the final and non-final cache updates. Behaviour for non-zero context sizes is unchanged.Type of change
Validation
python -m compileall funasr examples testsDocs or links checked
Runtime/deployment command tested
python tests/test_funasr_onnx_paraformer_online_overlap.pyagainst the installed package: 3 passed. Against the unfixed package, the two zero-context tests fail and the non-zero test passes.The test is added to
test-funasr-onnx-package.yml(path filters and a step after the installed-wrapper check), so CI runs it against the built wheel.AISHELL-1 test (7176 utterances),
iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-onlinev2.0.5,chunk_size=[0, 10, 5], onnxruntime 1.20.1 CPU, dither 0:PyTorch AutoModel with the same settings: 14.81%.
chunk_size=[5, 10, 5], outputs for the sampled utterances are identical before and after (the fix does not change slicing for non-zero sizes).User impact
Removes the extra tail decoding caused by retaining all overlap frames when the requested context size is zero. This affects users running the streaming ONNX model with the documented
chunk_size=[0, 10, 5]. Other trailing repeats that also appear in the PyTorch reference are out of scope.Notes for reviewers
Only
paraformer_online_bin.pyis affected; the C++ runtime does not use this code. Running black on the file also reformats unrelated pre-existing lines, so those are left untouched.