#2375 2025/12/30 20:16:02 [ERR] Traceback (most recent call last): File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzyla

117.181* Posted at: 7 hours ago 👁11

2025/12/30 20:16:02 [ERR] Traceback (most recent call last): File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\webui.py", line 84, in tts = IndexTTS2(model_dir=cmd_args.model_dir, File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\indextts\infer_v2.py", line 142, in init self.s2mel = s2mel.to(self.device) File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\build_venv\lib\site-packages\torch\nn\modules\module.py", line 1369, in to return self._apply(convert) File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\build_venv\lib\site-packages\torch\nn\modules\module.py", line 928, in _apply module._apply(fn) File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\build_venv\lib\site-packages\torch\nn\modules\module.py", line 928, in _apply module._apply(fn) File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\build_venv\lib\site-packages\torch\nn\modules\module.py", line 928, in _apply module._apply(fn) [Previous line repeated 3 more times] File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\build_venv\lib\site-packages\torch\nn\modules\module.py", line 955, in _apply param_applied = fn(param) File "C:\Users\geoo\Desktop\yzylauncher-index-tts-2.0\yzylauncher-index-tts-2.0.7z\yzylauncher-index-tts-2.0\python\build_venv\lib\site-packages\torch\nn\modules\module.py", line 1355, in convert return t.to( torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 20.00 MiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Of the allocated memory 7.11 GiB is allocated by PyTorch, and 50.84 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

1 Replies

您遇到的错误是典型的 CUDA 显存不足。Index-TTS2 模型启动时即需要大量显存,而您的 GPU 总显存仅为 4GB,已完全被占用。

核心解决方案是释放显存并调整配置:

  1. 立即释放显存

    • 关闭所有正在运行的、可能占用 GPU 的程序(如其他 AI 软件、游戏、浏览器)。
    • 在 Windows 任务管理器的“性能”选项卡中,查看“GPU”部分,确认专用 GPU 内存使用率已降至最低。
  2. 为 Index-TTS2 设置环境变量(关键步骤)

    • 在启动 yzylauncher-index-tts-2.0webui.py 或启动脚本前,设置环境变量 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
    • Windows 命令行操作示例

      set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
      python webui.py
    • 或者,您可以创建一个批处理文件(.bat),将这两行命令写入其中,然后运行该批处理文件。
  3. 在 pyVideoTrans 中调整设置

    • 如果您想在 pyVideoTrans 中使用 Index-TTS2 进行配音,请确保在 主界面第6行勾选“CUDA加速”
    • 同时,在 菜单 -> 工具 -> 高级选项 中,检查并确保“CUDA数据类型”设置为 float16int8(而非 float32),这能显著减少显存占用。
  4. 终极方案(如果以上无效)

    • 您的 4GB 显存对于 Index-TTS2 可能过于紧张。考虑:

      • 使用对显存要求更低的 TTS 模型,例如 VITS-cnenPiper-TTS(pyVideoTrans 内置)或 Edge-TTS(在线免费)。
      • 升级您的显卡硬件。

请注意:此错误发生在您独立运行的 Index-TTS2 启动器中,与 pyVideoTrans 主程序无直接关系。您需要先确保 Index-TTS2 服务能成功启动,pyVideoTrans 才能调用它。

请查看更多参考文档:

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.

Donate: https://ko-fi.com/jianchang512

Trending Questions