#3669 连接 GPT_SoVITS API 报错

112.64* Posted at: 1 day ago 👁27

{'message': 'tts failed', 'Exception': 'Input type (torch.FloatTensor) and weight type (torch.HalfTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor'}:
Traceback (most recent call last):
File "videotrans\util\ListenVoice.py", line 16, in run
File "videotrans\tts\__init__.py", line 336, in run
File "videotrans\tts\_base.py", line 178, in run
RuntimeError: {'message': 'tts failed', 'Exception': 'Input type (torch.FloatTensor) and weight type (torch.HalfTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor'}

3 Replies

这是由于 GPT-SoVITS API 服务端模型权重数据类型与输入数据不匹配导致的。

解决方案

  1. 检查并确保你的 GPT-SoVITS API 服务端版本与 pyVideoTrans 兼容。
  2. 在启动 GPT-SoVITS 的 WebUI 或 API 服务时,尝试添加 --precision fp32 参数,强制使用单精度浮点数(Float32)模式运行,以避免数据类型冲突。
  3. 如果问题依旧,请检查 GPT-SoVITS 项目是否有更新,并按照其官方文档重新部署 API 服务。
  4. 在 pyVideoTrans 的“菜单-翻译设置-GPT-SoVITS 设置”中,确认 API 地址(如 http://127.0.0.1:9880)填写正确。

请查阅相关文档:

api_v2.py: error: unrecognized arguments: --precision fp32

这是由于 GPT-SoVITS API 服务端版本较新,不支持 --precision fp32 参数导致的。解决方案:检查你的 GPT-SoVITS 项目版本。对于较新的版本(如 v1.1.1 或更高),启动 API 服务时,请使用 --precision full 参数来强制使用全精度模式,或者尝试移除所有精度相关参数,使用默认设置。请查阅相关文档:GPT-SoVITS API 使用方法

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Related resource