Repository navigation
fix(auto): honor merge_length_s passed to generate() - #3841
Merged
LauraGPT merged 1 commit intoNov 5, 2026
Merged
Conversation
With merge_vad=True, inference_with_vad read merge_length_s from the construction kwargs before the call options were merged in, so a value passed to generate() (as in the SenseVoice README and demo) was silently ignored and the construction value or the 15 s default was used instead. Read the per-call value first and fall back to the construction value, then the 15 s default. Update the Python API docs accordingly.
LauraGPT
approved these changes
Nov 5, 2026
LauraGPT
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed all four changed files at 099c2f4404be97c28ce20aa980afd8295d8dab37. Reading the per-call option before VAD merging fixes the ignored override while preserving the construction/default fallback and disabled-merge behavior. Both language references match the implementation.
Validation on the current-main candidate tree 175297234949cfbbba44e5b377f06b7d80c3b5c3:
- Baseline reproduced the two submitted override failures; all 36 selected CPU regression/documentation tests passed with the change.
- 32 real L20Z FP32 integration cases through
AutoModel.generate, configuration reset, audio slicing and batched inference: baseline failed 8, candidate passed 32/32. Construction defaults/10s, repeated per-call 10s/default/15s/disabled, 1/2 inputs and 1s/300s batch budgets were covered. Each phase recorded 1,072 CUDA events and per-case raw results. - The GPU backends are explicit analytic torch fixtures with a zero scalar parameter, not pretrained ASR/VAD weights. This establishes wrapper/CUDA integration behavior, not ASR quality, Windows/NPU support or a full-suite result. No models were downloaded.
- Exact-head hosted CI logs and NumPy 1.26.4/2.4.0 artifacts were inspected. Those existing workflows do not run the new four-case regression; its passing result above is local, not attributed to hosted CI.
The earlier stale GitHub potential merge was not used as the tested current-main tree. The candidate retains the intervening standalone runtime release changes. Source fix only: existing published package bytes are unchanged. Normal merge and current protection checks apply.
Merged
LauraGPT
added a commit
that referenced
this pull request
Nov 5, 2026
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
With
merge_vad=True,AutoModel.inference_with_vadreadmerge_length_sfrom the construction kwargs before the per-call options were merged in. A value passed togenerate()was therefore ignored, and the construction value or the 15 s default was used instead. The SenseVoice README andexamples/industrial_data_pretraining/sense_voice/demo.pyboth passmerge_length_stogenerate(), so the documented usage had no effect for any value other than 15.The merge step now uses the per-call value first, then the construction value, then the 15 s default. The
merge_length_srow indocs/python_api.md/docs/python_api_zh.mdno longer tells users to set it at construction.Reproduction (VAD segments
[[0, 4000], [5000, 9000], [10000, 14000]],generate(..., merge_vad=True, merge_length_s=10)):[[0, 14000]](15 s default used)[[0, 9000], [9000, 14000]]Type of change
Validation
python -m compileall funasr examples teststests/test_python_api_docs_contract.py)New
tests/test_merge_vad_length.py(CPU only, mocked models, no downloads): the two per-call cases fail on main and pass with this change; default and construction-time behavior is unchanged.tests/test_punc_model_none.pyandtests/test_python_api_docs_contract.pypass.User impact
Users following the SenseVoice examples with
merge_vad=Truecan now control the merged segment length per call, as the README describes.Notes for reviewers
Construction-time
merge_length_skeeps working; a per-call value now takes precedence, consistent with how othergenerate()options are applied.