消除AttributeError: module ‘ttsfrd‘ has no attribute ‘TtsFrontendEngine‘报错输出的记录

#工作记录

尝试消除

消除“模块ttsfrd没有属性ttsfrontendengine”的错误的记录

报错摘录:

Traceback (most recent call last):
  File "F:\PythonProjects\CosyVoice\webui.py", line 188, in <module>
    cosyvoice = CosyVoice(args.model_dir)
  File "F:\PythonProjects\CosyVoice\cosyvoice\cli\cosyvoice.py", line 41, in __init__
    self.frontend = CosyVoiceFrontEnd(configs['get_tokenizer'],
  File "F:\PythonProjects\CosyVoice\cosyvoice\cli\frontend.py", line 65, in __init__
    self.frd = ttsfrd.TtsFrontendEngine()
AttributeError: module 'ttsfrd' has no attribute 'TtsFrontendEngine' 

找到代码部分发现运行时强制使用 ttsfrd ,但是试了多种方法还是不管用,于是在代码中设置成禁用了:

#    use_ttsfrd = True
    use_ttsfrd = False

 禁用后没有再输出报错信息。查阅了一下,禁用 ttsfrd ,项目会调用WeTextProcessing来代用。

 

尝试修复

 其他修复方案可尝试:

pip install --upgrade ttsfrd
pip install "modelscope[audio]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模块ttsfrd没有属性ttsfrontendengine的错误通常发生在代码逻辑中试图访问ttsfrd模块中不存在的属性或方法时。

这可能是由于安装不正确、版本不匹配,或者仅仅是拼写错误。

示例

import ttsfrd
ttsfrd.ttsfrontendengine()  # AttributeError: 模块 'ttsfrd' 没有属性 'ttsfrontendengine'

常见原因和解决方案

  1. 检查拼写错误 确保我们尝试访问的属性或方法名中没有拼写错误。

    示例

    import ttsfrd
    ttsfrd.ttsfrontendengine()  # 错误写法

    解决方法: 从模块的文档中验证正确的属性或方法名

    import ttsfrd
    ttsfrd.correct_method_name()  # 正确用法
  2. 验证安装 确保ttsfrd模块已正确安装。我们可以使用pip重新安装它。

    示例

    pip install ttsfrd -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
  3. 检查模块版本 确保我们使用的ttsfrd模块版本包含ttsfrontendengine属性。

    示例

    pip show ttsfrd

    查看版本信息,并在必要时更新

    pip install --upgrade ttsfrd -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
  4. 使用 ModelScope 音频依赖 如果ttsfrd是 ModelScope 的一部分,我们可以安装所有音频依赖以确保兼容性。

    示例

    pip install "modelscope[audio]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

love530love

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值