Repository navigation
Conversation
Integrate ychy7001's #3792 inference change and regressions with the #3790 cache checks. The combined tree passed 55 focused CPU tests and 20 real synthetic FP32 L20Z boundary cases, plus exact-head CI and package-byte acceptance. Not pretrained ASR accuracy or a package publication. Signed-off-by: LauraGPT <zhifu.gzf@alibaba-inc.com>
|
Thanks @ychy7001. Your one-line empty split-final fix and the exact five regression methods are now integrated through #3808, preserving contributor credit. After #3790 merged, only the workflow had three conflicts; the integration keeps both regressions and both event filters. The combined tree passed 55 focused CPU tests and 20 real L20Z CUDA boundary cases. New-head and final-main Python 3.11/3.12 CI, actual wheel/sdist source bytes and both regression logs were accepted. GPU inputs/ONNX parameters are explicit synthetic fixtures, not pretrained ASR accuracy or a full suite. No new weights were downloaded. Closing this PR as superseded, not as merged: the original fork branch/head is unchanged. The fix is on main; no new standalone ONNX PyPI release is claimed here. |
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.