You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
我正在为一个 PC 端项目做 TTS 语音模块的本地部署替换,目标是从云端 API 方案迁移到 Android 端同款的 Bert-VITS2 (MNN 格式)本地推理。
目前已成功完成:
✅ MNN 模型加载(emb、bert、enc_p、dp、flow、dec 六个模型均加载成功)
✅ 说话人嵌入(meju_emb.mnn)正确生成
✅ BERT 文本特征提取(使用 tokenizer.json + chinese-roberta-wwm-ext-large-distilled-fp16.mnn)
✅ G2P 文本转音素(使用 opencpop-strict.txt,429 个音素,pypinyin Style.NORMAL 无声调模式)
✅ HTTP 服务与游戏客户端通信正常(修复了 Transfer-Encoding: chunked 问题)
✅ flow → dec 链路验证通过:用随机噪声可以生成有意义的语音波形
卡点:模型在 enc_p 阶段崩溃,日志报错:
text
Broad cast error, dim1 = 15, dim2 = 2880
Compute Shape Error for /Add_output_0
Can't run session because not resized
我尝试过的 x 输入 shape(全部失败):
(1, 192 * phone_len) → Broad cast error, dim1 = 15, dim2 = 2880
(1, 192, phone_len) → Broad cast error, dim1 = 15, dim2 = 192
(1, phone_len, 192) → Broad cast error, dim1 = 15, dim2 = 192
(1, phone_len) → Broad cast error
enc_p 模型的输入输出信息(通过 MNN.Interpreter.getSessionInputAll 获取):
text
enc_p inputs: {'bert_0': (1, 1024), 'bert_1': (1, 1024), 'bert_2': (1, 1024),
'g': (1, 512, 1), 'language': (1, -1), 't': (1, -1),
'x': (1, -1)}
enc_p outputs: {'logs_p': ..., 'm_p': ..., 'x_mask': ..., 'xout': ...}
其他已知信息:
t 输入为 (1, phone_len),即音素 ID 序列
g 输入为 (1, 512, 1),来自 meju_emb(sid=0)
language 输入为 (1, 1),固定为 [0](中文)
采样率 = 22050
dp 模型输出为 logw(不是 cum_duration)
原始的 Android 端使用 libBertVITS2.so 作为 JNI 推理引擎
求助问题:
1.x 的正确 shape 是什么?数据类型是 float32 吗?
2.是否需要特殊初始化(全零 / 随机噪声 / 其他)?
3.是否需要对 x 进行 reshape 或 transpose 操作后再传入 enc_p?
可提供材料:如有需要,我可以提供模型文件列表、opencpop-strict.txt、完整错误日志,以及 MNN 版本的 API 调用代码。
感谢!
Beta Was this translation helpful? Give feedback.
All reactions