在 WSL 中使用 NVIDIA 显卡加速 Whisper.cpp

系统环境

OS: Debian GNU/Linux 12 (bookworm) on WSL2

GPU: NVIDIA GeForce RTX 3060M

安装 CUDA

参考 WSL 安装 CUDA

编译 Whisper.cpp

bash
git clone https://github.com/ggml-org/whisper.cpp.git
cd whisper.cpp
cmake -B build -DGGML_CUDA=1
cmake --build build -j --config Release

可执行文件产物默认在 ./build/bin

下载GGML模型

whisper.cpp 内置了下载脚本并提供了一些已经转换为 ggml 格式的模型

例, 下载 large-v3:

bash
sh ./models/download-ggml-model.sh large-v3

模型默认存储在 ./models

运行

./build/bin/whisper-cli -m models/ggml-large-v3.bin -f <音频文件路径> -l auto

一些命令行参数:

  • -m <模型路径>: 指定模型路径
  • -f <音频文件路径>: 指定音频文件路径
  • -l <语言>: 指定语言, auto表示自动检测
  • -olrc: 输出 lrc 格式的字幕
  • -otxt: 输出纯文本格式的字幕
  • -osrt: 输出 srt 格式的字幕
  • -ocsv: 输出 csv 格式的字幕
  • -ojf: 输出 json 格式的字幕

To Be Continued.
Go:x/crypto/ssh 的全局请求通道竞争