Skip to content

Fix runtime hotword bounds on current main (preserves #3882) - #3885

Merged
LauraGPT merged 2 commits into
mainfrom
codex/pr3882-current-main-20261112
Nov 12, 2026
Merged

LauraGPT merged 2 commits into
mainfrom
codex/pr3882-current-main-20261112

Conversation

@LauraGPT

Copy link
Copy Markdown
Collaborator

Summary

Integrate the original #3882 hotword fix on the current accepted 1.4.26 main, retaining the original author's commit as the parent. Relative to current main this changes only the original three files: the ONNX and Torch hotword preprocessing and its native-runtime tests. The original fork branch is untouched. Refs #3881.

The exported embedding input is ten characters wide. The fix keeps the supported prefix of longer words, computes positions after truncation, and drops empty entries produced by whitespace.

Verification

  • Four author regression cases fail on baseline; the current-main CLI/native CPU set passes all 63 cases without skips.
  • Real L20Z FP32 validation passed 24 combinations (ONNX/Torch, Contextual/Seaco, batches 1/2, long/empty/whitespace hotwords), producing 72 recorded outputs from three distinct synthetic audio files. Torch recorded 856 CUDA events, and eight ONNX session profiles confirmed CUDA node execution.
  • The four baseline long-input errors occur in CPU preprocessing before GPU graph execution; they are not counted as GPU inferences.
  • These are fixed synthetic graph fixtures, not pretrained ASR-quality, full-suite or Nano results. Torch fixtures are numerically identical GPU-serialized copies, not a fix or claim for automatic device placement.
  • Completed tests are reused through exact source hashes. Only eight release version/docs/test files differ from the originally tested tree; all runtime and fixture sources are byte-identical. No unchanged tests were rerun to inflate coverage.
  • The original head's three workflows were accepted from actual artifacts/logs; its ONNX checkout used an older PR merge. Those records are historical evidence, not acceptance of this new head. New-head hosted CI and current protected-branch gates remain required before merging.

This does not publish standalone ONNX or Torch distributions, and the already published root 1.4.26 does not contain this later runtime change. No production service or model-weight download was performed.

tanishqbaweja and others added 2 commits November 12, 2026 18:05
ContextualParaformer.proc_hotword in funasr_onnx and funasr_torch
(SeacoParaformer inherits it) split the hotword string with split(" ")
and padded each hotword into a row of 10 ids. A hotword longer than 10
characters did not fit, so the whole call raised "ValueError: could not
broadcast input array from shape (12,) into shape (10,)". Repeated,
leading or trailing spaces, and an empty hotword string, gave empty
hotwords: rows of padding whose embedding was read at position -1 and
passed to the model as extra hotwords.

The exported embedding model takes exactly 10 ids per hotword (only
num_hotwords is dynamic in ContextualEmbedderExport), and the C++
runtime (CompileHotwordEmbedding in paraformer.cpp and
paraformer-torch.cpp) keeps the first max_hotword_len = 10 tokens of
each hotword and skips empty ones. Do the same: split on whitespace, as
generate_hotwords_list in funasr/models does, and keep the first 10
characters of each hotword.

Extend tests/test_runtime_eval_native.py: for both classes in both
packages, built from the hotword fixture graphs, check the hotword ids
and embedding positions for a string with extra spaces and a
12-character hotword and for an empty string, and that both strings
decode every file.
Retain the original #3882 author commit and carry forward the exact accepted 1.4.26 main tree. Only the original three-file hotword patch differs from main.

Signed-off-by: LauraGPT <zhifu.gzf@alibaba-inc.com>
@LauraGPT
LauraGPT merged commit 6f52414 into main Nov 12, 2026
14 checks passed
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