#5058 AttributeError: module 'torch' has no attribute 'cuda'

120.228* Posted at: 13 hours ago

module 'torch' has no attribute 'cuda',Traceback (most recent call last):
File "videotrans\util\checkgpu.py", line 17, in run
File "videotrans\util\gpus.py", line 21, in getset_gpu
AttributeError: module 'torch' has no attribute 'cuda'


=
system:Windows-10-10.0.18363-SP0
version:v4.01
frozen:True
language:zh
root_dir:D:/BaiduNetdiskDownload/win-pyvideotrans-v4.01-0602

1 Replies

该错误是因为 PyTorch (torch) 没有检测到 CUDA 支持,通常由以下原因引起:

  • 电脑没有 NVIDIA 显卡,或显卡驱动/ CUDA / cuDNN 未正确安装(打包版需要系统级 CUDA 12.8+ 环境,而非 Python 包自带)。
  • 打包版文件损坏,或覆盖了不兼容的补丁包。

解决方案:

  1. 检查硬件:确认电脑有 NVIDIA 显卡,并安装最新驱动。
  2. 重新安装完整包:前往官方下载页面下载完整版 .7z 包(不要只下载补丁),解压到纯英文路径(如 D:\pyVideoTrans),然后双击 sp.exe 启动。
  3. 若软件可启动:在菜单栏 工具/选项 → 高级选项 中,取消勾选 CUDA加速,使用 CPU 模式(处理速度会较慢)。
  4. 检查 CUDA 环境:若需 GPU 加速,请确保系统已安装 CUDA 12.8+ 和 cuDNN 9.x,并在命令行运行 nvcc -Vnvidia-smi 确认可用。

如果上述步骤仍无法解决,请提供 logs/ 目录下最新日志文件的最后 30 行内容,以便进一步分析。

请查阅相关文档:

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. Dondate: ko-fi.com/jianchang512

Related resource

Similar issues already exist