FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

Fun-ASR-Nano模型打开merge_vad参数后标点符号的时间戳不对

Open jhao104 opened this issue 2 months ago • 3 comments

使用Fun-ASR-Nano模型打开merge_vad参数后,标点符号的时间戳计算不对 本句话的标点符号的时间戳计算到下一句话开始的时间上了

jhao104 avatar Sep 11 '26 08:09 jhao104

发布可用性更新(2026-11-01)

下面关于 PyPI 1.4.16 尚未包含补丁的说明是当时的历史状态。现在,已发布的 FunASR 1.4.19 wheel 已包含 #3703 的标点锚定 helper,以及 offline、vLLM 和 pipeline 三处调用;获取这些包内改动不再需要从 main 构建。在隔离环境中可安装 python -m pip install "funasr==1.4.19",并确认实际导入的是该环境的包。

本次重新校验了已下载官方 wheel 的 SHA256/大小,并逐字节核对上述四个相关模块与 v1.4.19 对应源码 一致。这只确认包内可用性,不声称 1.4.19 是首次包含该修复的版本,也没有重跑模型、GPU 或原始跨 VAD 录音。原始场景的复测要求仍然有效,此 issue 保持开放。


状态更新(2026-09-29):此前“修复仍在审查中”的说明已过期,现更正。

  • 修复 PR #3703 已于 9 月 25 日合入 main,合并提交为 41778c45。此前审查发现的多字节中文片段以及 C++、$10 语义符号时间跨度问题也已修正,不需要为同一修复重复开 PR。
  • 合并到源码不等于已发布到 pip。 本次核查的 PyPI 最新版本仍是 funasr 1.4.16,发布于 9 月 18 日。我下载并校验了该 wheel 的 SHA256,检查确认它还没有标点锚定 helper,也没有 offline/vLLM/pipeline 三处调用。因此,仅升级到这个 PyPI 版本不会获得本补丁。
  • 如需先验证,请在独立环境中使用包含上述合并提交的源码 checkout,并确认实际导入的是该 checkout,而非环境里原有的 pip 包。版本号本身不能区分已发布的 wheel 和尚未发版的源码改动。
  • 本次在合并提交上额外运行了 4 个相关测试文件,20 项通过,覆盖标点锚定、真实 tokenizer/forced_align 下的字节片段和语义符号跨度保留,以及 pipeline 的 VAD 段边界。使用的是合成对齐数据;这不代表原始录音、真实模型、GPU 或完整 vLLM 服务已经验收。

此 issue 继续保持打开,等待原始场景复测。请用原来的跨 VAD 多句音频和相同配置验证;若仍不正确,请补充实际源码提交、使用 offline/vLLM/pipeline 哪条路径、相关 VAD 参数,以及出错句界附近的 VAD 区间和 timestamp 输出。音频可以是脱敏后的最短复现,不必公开完整敏感录音。

协作补充(2026-10-01):感谢 @HarshXAI 愿意排查。#3703 已合入,建议先在包含 41778c45de5094b664af3aa978718b56a14896cb 的源码上复测,避免重复实现同一修复。当前尚缺的是原始跨 VAD 录音场景的验证;已有合成对齐测试不能替代它。如果能在当前源码复现,请记录实际导入路径与提交、调用路径及句界附近的 VAD/timestamp 输出,再针对仍失败的最小用例提交回归测试。请不要公开敏感录音。

LauraGPT avatar Sep 13 '26 04:09 LauraGPT

When merge_vad merges several VAD segments into one, punctuation tokens inherit the merged span's end — a sentence's punctuation gets timestamped at the next sentence's start. PR #3703 already fixes punctuation timestamps across VAD merges and is under review; reviewers found residuals (multi-byte tokens, semantic symbols like 'C++' collapsing spans to zero length). The word-anchored remapping below re-projects anchors so those residuals become structurally impossible. The merge step needs anchor remapping: each token keeps a pointer to its pre-merge segment-local offset; timestamps are recomputed through the merge mapping, not the merged span. This is what I built into a word-anchored timeline compiler — anchors live at token level; any segment-level transform re-projects them:

t(token) = seg.start + map_local(token.offset)

Add a regression test running merge_vad on multi-sentence audio, asserting punctuation timestamps stay monotonic and sentence-bounded. Want me to take a crack at it? Happy to open a PR with working code.

chenhz01 avatar Sep 22 '26 08:09 chenhz01

I can dig into this.

With merge_vad on Fun-ASR-Nano, punctuation timestamps drift / misalign. I’ll reproduce on a short CN clip, trace how merge_vad remaps segment boundaries vs punctuation post-processing, and fix alignment so punctuation stays inside the merged speech spans.

Will add a small regression fixture around merge_vad + punctuation timing.

HarshXAI avatar Sep 30 '26 03:09 HarshXAI