Repository navigation
Conversation
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 #3791.
When a final call is split into two chunks and both
infer()calls return[], the merge loop leavesres = {}and__call__returns[{}]. The officialruntime/python/onnxruntime/demo_paraformer_online.pycheckslen(rec_result) > 0before accessingrec_result[0]["preds"][0], so this result passes the check and raisesKeyError: 'preds'.Change one runtime line to
return [res] if res else []. Normal recognition and merging are unchanged, including a result from only one of the two chunks. Single-chunk results, including[{"preds": ("", [])}], are unchanged.infer()andsentence_postprocess()are untouched.Type of change
Validation
PYTHONPATH=runtime/python/onnxruntime python tests/test_funasr_onnx_paraformer_online_empty_final.py -v: 5 passed. On fbbfe01, only the both-chunks-empty test fails ([{}] != []); the other 4 pass. Tests mock feature extraction andinfer()while exercising the real__call__, cache preparation and overlap splitting. No model downloads are needed.chunk_size=[5, 10, 5]: a 9600-sample non-final silence call followed by a 16000-sample final silence call returns[{}]before the fix and triggers the demo's access error. After the fix it returns[]without an error. No overlap-slicing monkeypatch was used.BAC009S0764W0129, appending 0, 0.6, 1, 1.2, 2, 3 or 5 seconds of silence and using the demo's 9600-sample step did not trigger the error. Results were identical before and after. The reproduced 16000-sample final call is larger than the demo's usual step; this does not establish that trailing silence generally crashes the demo loop..github/workflows/test-funasr-onnx-package.yml(path filters and a step after the wheel install).git diff --checkpassed.Notes for reviewers
A caller could theoretically treat
[{}]as a status signal, so returning[]changes that observation. The tradeoff is to represent the absence of recognition results consistently withinfer()and avoid the official demo'sKeyError.Other output consistency issues, including single-chunk tuple versus split-chunk list values under
preds, are outside this change. This PR does not depend on #3790. The commit contains the one-line runtime fix, a regression test file, and the workflow entry that runs the test inValidate funasr-onnx packageafter the wheel is installed.