#4679 RuntimeError: {'message': 'tts failed', 'Exception': '[ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during init

117.174* Posted at: 13 hours ago 👁19

{'message': 'tts failed', 'Exception': '[ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: bad allocation'}:
Traceback (most recent call last):
File "videotrans\util\ListenVoice.py", line 16, in run
File "videotrans\tts\__init__.py", line 370, in run
File "videotrans\tts\_base.py", line 181, in run
RuntimeError: {'message': 'tts failed', 'Exception': '[ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: bad allocation'}


=
system:Windows-10-10.0.28000-SP0
version:v3.98
frozen:True
language:zh
root_dir:F:/app/win-pyvideotrans-v3.98-0410

1 Replies

这是由于内存(RAM或显存)不足导致的初始化失败,本地TTS模型(如CosyVoice、F5-TTS等)在加载时需要较大的连续内存空间,当系统资源紧张时会出现“bad allocation”错误。

解决方法:

  1. 关闭其他占用内存的程序,确保至少有 8GB 可用内存(若使用大型模型建议 16GB 以上)。
  2. 切换到 Edge-TTS(免费在线):在主界面配音渠道选择 Edge-TTS(免费),无需加载本地模型,不消耗额外内存。
  3. 若坚持使用本地 TTS

    • 尝试更换为更轻量的模型,如 ChatTTS(要求较低)。
    • 菜单 → 工具 → 高级选项 中,降低 “同时配音线程数” 为 1,并增加 “配音后暂停秒” 为 5-10 秒,以减少并发压力。
  4. 升级到最新版本 v3.99:此版本修复了部分内存管理问题,可从官网下载完整包覆盖升级(注意不要使用旧版补丁包)。
  5. 检查显卡显存:若使用了 GPU 加速,确保显存充足(本地 TTS 模型至少需要 4GB 显存)。可在 CMD 运行 nvidia-smi 查看显存使用情况。

请查阅相关文档:

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