Skip to content

fix: 修复多个模块中的独立 bug(distrib / spec_utils / text_seg / funasr)#2755

Open
wishhyt wants to merge 1 commit intoRVC-Boss:mainfrom
wishhyt:fix/misc-module-bugs
Open

fix: 修复多个模块中的独立 bug(distrib / spec_utils / text_seg / funasr)#2755
wishhyt wants to merge 1 commit intoRVC-Boss:mainfrom
wishhyt:fix/misc-module-bugs

Conversation

@wishhyt
Copy link
Copy Markdown

@wishhyt wishhyt commented Mar 18, 2026

问题描述

修复分散在 4 个不同模块中的独立 bug:

1. [HIGH] distrib.py sync_buffer 除以函数对象

buffer.data /= world_sizeworld_size 是函数(定义在第 21 行),
缺少 () 调用,导致 TypeError。同文件第 108 行的 sync_grad 已正确使用
world_size(),此处是遗漏。

2. [HIGH] spec_utils.py istft() 缺少 return 语句

函数计算了 wave = np.asfortranarray([wave_left, wave_right]) 但未返回,
所有调用者得到 None

3. [MEDIUM] text_segmentation_method.py cut0 返回 "/n" 而非 "\n"

cut0("不切"模式)在输入为纯标点时返回字面字符串 "/n" 而非换行符 "\n"
后续 text.split("\n") 无法正确切分,/n 会作为文本内容传入 TTS 管线。

4. [HIGH] funasr_asr.py vad_model_revision 被无条件覆盖

第 54 行 vad_model_revision = punc_model_revision = "v2.0.4" 位于 if/elif/else
块之外,将粤语分支(不使用 VAD/标点模型)中设置的空字符串覆盖为 "v2.0.4"。

修改内容

  • world_sizeworld_size()
  • 添加 return wave
  • "/n""\n"
  • 将版本赋值移入 if language == "zh" 分支内

测试方案

  • 多 GPU 分布式训练验证 sync_buffer 不再报错
  • UVR5 音频处理验证 istft 返回正确数据
  • 使用 "cut0"(不切)模式进行 TTS 推理
  • 使用粤语(yue)进行 FunASR 语音识别

1. 修复 sync_buffer 中除以函数对象而非调用结果(distrib.py)
   - `buffer.data /= world_size` 中 world_size 是函数,缺少 (),
     导致 TypeError 使分布式训练 buffer 同步失败

2. 修复 istft 函数缺少 return 语句(spec_utils.py)
   - 函数计算了结果但未返回,调用者始终得到 None

3. 修复 cut0 返回字面量 "/n" 而非换行符 "\n"(text_segmentation_method.py)
   - 导致后续 text.split("\n") 无法正确切分,字面 /n 被当作文本内容

4. 修复粤语 ASR 的 vad/punc model_revision 被无条件覆盖(funasr_asr.py)
   - 粤语分支将 vad_model_revision 设为空(因不使用 VAD/标点模型),
     但 if/else 外的赋值将其覆盖为 "v2.0.4",传入错误的 revision 参数

Made-with: Cursor
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.

1 participant