#2302 怎样让项目使用到GPU 有什么设置

2401:b60* Posted at: 1 day ago 👁15

2025-12-26 17:46:46,261 - INFO - 收到请求: 模型='large-v3-turbo', 语言='ja', 提示词='无'
2025-12-26 17:46:46,408 - INFO - 正在将上传的文件 'E:/AI/【视频语音互相转】win-pyvideotrans-3.90/tmp/15928/f40f5440c6/ja.wav' 转换为标准的 16kHz 单声道 WAV 格式...
2025-12-26 17:46:46,763 - INFO - 文件格式转换成功。
2025-12-26 17:46:47,217 - INFO - 正在加载 Whisper 模型 'large-v3'...
2025-12-26 17:46:52 - whisperx.asr - INFO - No language specified, language will be detected for each audio file (increases inference time)
2025-12-26 17:46:52 - whisperx.vads.pyannote - INFO - Performing voice activity detection using Pyannote...
Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.5.6. To apply the upgrade to your files permanently, run python -m pytorch_lightning.utilities.upgrade_checkpoint E:\AI\whisperx-api\.venv\lib\site-packages\whisperx\assets\pytorch_model.bin
E:\AI\whisperx-api.venv\lib\site-packages\pyannote\audio\core\io.py:212: UserWarning: torchaudio._backend.list_audio_backends has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release.
torchaudio.list_audio_backends()
Model was trained with pyannote.audio 0.0.1, yours is 3.4.0. Bad things might happen unless you revert pyannote.audio to 0.x.
Model was trained with torch 1.10.0+cu102, yours is 2.8.0+cpu. Bad things might happen unless you revert torch to 1.x.

1 Replies

要让 pyVideoTrans 使用 GPU 加速,您需要在主界面进行设置,并确保您的环境已正确配置 CUDA。

核心设置步骤:

  1. 勾选 CUDA 加速:在 pyVideoTrans 主界面第 6 行,务必勾选“CUDA加速”。这是启用 GPU 的关键开关。
  2. 检查环境:确保您的系统已安装 NVIDIA 显卡驱动程序、CUDA Toolkit 和 cuDNN。pyVideoTrans 的 faster-whisper 组件通常需要 CUDA 11.8 或更高版本。
  3. 选择本地模型:在“语音识别”区域,选择 faster-whisper(本地)openai-whisper(本地) 等本地模型才能利用 GPU。

根据您的日志分析:
您的日志显示 torch 2.8.0+cpu,这表明当前 PyTorch 安装的是 CPU 版本,无法使用 GPU。您需要安装支持 CUDA 的 PyTorch。

解决方案:

  1. 对于预打包版 (Windows):通常已包含 CUDA 环境。如果勾选“CUDA加速”后仍报错或速度无提升,请尝试在“高级选项”中,将“CUDA数据类型”从 float32 改为 float16int8 以降低显存占用。
  2. 对于源码部署版:您需要重新安装支持 CUDA 的 PyTorch。请根据您的 CUDA 版本,访问 PyTorch 官网 获取安装命令。例如,对于 CUDA 12.1,命令类似:

    pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

    安装后,重启 pyVideoTrans。

高级选项微调 (解决显存不足):
如果启用 GPU 后出现“显存不足 (Out of Memory)”错误,请在“高级选项”中进行以下调整:

  • CUDA数据类型:改为 int8
  • 识别准确度:将 beam_sizebest_of 都改为 1
  • 模型大小:使用更小的模型(如 medium 而非 large-v3)。

有用的文档链接: windows上安装CUDA12.6和cuDNN9.8

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