mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-11-05 00:27:30 +00:00
[GH-ISSUE #2864] 索引检索被静默禁用导致音频卡顿/断续(nprobe 未设置) #2063
Labels
No labels
AMD/Intel
bug
bug
bug
colab
dependencies
documentation
duplicate
enhancement
following up
good first issue
help wanted
invalid
question
stale
stale
stale
todo list
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
RVC-Project/Retrieval-based-Voice-Conversion-WebUI#2063
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tayunxunyin on GitHub (Sep 26, 2026).
Original GitHub issue: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/2864
极其严重的bug,会导致模型产生严重卡顿和人机感,我不懂代码,遇到后叫dsh帮我查找修复并总结了一下,以下是dsh对bug的描述: # RVC 实时变声:索引检索被静默禁用导致音频卡顿/断续(nprobe 未设置)
环境
2.3.260718(整合包RVC20260718Nvidia50x0.7z)go-realtime_gui.bat(realtime_gui.py)added_IVF978_Flat_nprobe_1_*.index(38156 向量)现象
实时变声中,命令行反复打印:
但使用的确实是
added_xxxx.index。实际听感:index_rate=0)后反而变得明显更流畅根本原因
1. 提示文本与实际判断条件无关
infer/rtrvc.py第 250-270 行:判断条件是
(ix >= 0).all(),完全没检查文件名是否包含trained。提示文本具有误导性。2.
-1来自 FAISS,因为nprobe从未被设置infer/rtrvc.py第 84-90 行加载索引:这里没有设置
self.index.nprobe,IndexIVFFlat的默认值是1。索引构建时使用了很激进的聚类数(
nlist ≈ ntotal / 39):-1出现率因为平均每个聚类只有约 39 个向量,当一个查询落入稀疏聚类时,凑不满
k=8个邻居,FAISS 对缺失位置返回-1。3. 后果:特征流被不定时打断
(ix >= 0).all()只要发现任意一个-1,就会整块放弃检索,直接用未检索的 HuBERT 特征继续推理。实时变声按块处理后,同一个音频里有的块走「检索后的特征」,有的块走「原始特征」——模型每一块的输入特征分布都在跳变,于是产生卡顿和音色不稳定。
复现(500 次随机查询,k=8):
建议的修复
主修复:加载索引时设置
nprobeinfer/rtrvc.py,在第 85-86 行之间插入一行:infer/rtrvc.py的change_index_rate(第 141-146 行)也需要同样处理:次要修复:判断条件应逐行处理
-1,而不是全丢弃(ix >= 0).all()过于严格。建议改为只对存在-1的行回退到原始特征,其余行正常检索:另外:离线路径
infer/vc/pipeline.py第 183-186 行没有这个检查-1会被 NumPy 当作index_vectors[-1](即最后一个向量)解释,静默取到错误数据。实测影响很小,因为
weight = (1/score)²让最近邻的权重压倒性大、远处邻居权重趋近 0(实测-1位置的权重和为0.0000),但仍是隐患,建议一并加保护。补充说明
nprobe过小导致 FAISS 返回-1,与使用trained_还是added_索引无关。当前文本会把人引向错误方向(社区里已有人去排查索引文件名,见 #1907、#2585)。nprobe与运行时代码保持一致。生成索引时文件名里已经写了nprobe_1(例如added_IVF978_Flat_nprobe_1_*.index),说明这个参数是已知的,但读取端没有使用它。可以在read_index后用正则从文件名解析nprobe并设置。nprobe=8后,-1出现率从 1.12% 降到 0.00%,实时变声的卡顿与音色跳变问题消失,同一模型的主观听感显著改善。