M4 Pro 上的语音转录实战:从 CPU 煎蛋到 GPU 秒杀

起因

最近录了一段项目 brainstorm 的音频(15MB m4a,约 20 分钟),想转成文字方便后续整理。自然而然想到了 OpenAI 的 Whisper——开源、免费、本地运行,不用担心隐私问题。

设备是 MacBook Pro M4 Pro(24GB 统一内存)。

第一次尝试:CPU 直接跑 Whisper

直接用 Homebrew 安装的 whisper CLI,选了 turbo 模型:

whisper recording.m4a \
  --model turbo \
  --language en \
  --initial_prompt "Context about the recording topic." \
  --output_dir ./docs \
  --output_format txt

然后……等了 2.5 小时,CPU 温度飙升,风扇狂转,top 显示 CPU 占用超过 1000%。

输出目录是空的。一个字都没吐出来。

这也太离谱了。15MB 的音频,跑了快 3 小时还没结果。问题很明显:OpenAI 的 Python 版 Whisper 在 macOS 上默认走 CPU,完全没利用到 M4 Pro 的 GPU。

解决方案:mlx-whisper

Apple Silicon 的 Mac 有个专属的机器学习框架叫 MLX,是 Apple 官方开发的,类似 PyTorch 但专为 Apple 芯片优化。社区基于它做了 mlx-whisper,可以直接利用 Metal GPU 加速。

安装

# macOS Homebrew Python 不允许直接 pip install,用 pipx
pipx install mlx-whisper

运行

mlx_whisper \
  --model mlx-community/whisper-turbo \
  --language en \
  --initial-prompt "Context about the recording topic." \
  --output-dir ./docs \
  --output-format txt \
  recording.m4a

结果:几分钟内转录完成,质量很好,中英混杂的部分也识别得不错。

性能对比

方案耗时CPU 占用结果
whisper (CPU)2.5+ 小时>1000%无输出
mlx-whisper (GPU)~3 分钟正常完整转录

差距大约是 50 倍。如果你也在用 Apple Silicon Mac,mlx-whisper 是必选方案。

关于 turbo 模型

Whisper turbo 的全名是 large-v3-turboturbo 只是简写。它的原理是把 large-v3 的 32 层 decoder 裁剪到 4 层,再微调:

  • 参数量:809M(介于 medium 769M 和 large 1550M 之间)
  • 速度:是 large 的 ~8 倍
  • 精度:WER 仅增加约 1-2%
  • 只有多语言版本,没有 English-only 变体

对于大多数场景,turbo 是性价比最高的选择。

2026 年开源 STT 模型现状

调查了一下,发现 Whisper 其实已经很久没更新了:

  • 2022-09:Whisper 首发
  • 2023-11:large-v3 发布
  • 2024-10:large-v3-turbo 发布(最后一次更新)

OpenAI 的重心已经转向闭源 API(gpt-4o-transcribe),Whisper 开源版基本进入维护模式。

与此同时,其他开源模型已经超越了 Whisper:

模型WER亮点M4 Pro 兼容性
NVIDIA Canary Qwen 2.5B5.63当前开源最强⚠️ 依赖 NeMo,Mac 适配差
IBM Granite Speech 8B5.85企业级⚠️ 8B 模型太大,24GB 勉强
Whisper Large V37.4生态最成熟✅ mlx-whisper
Whisper Turbo7.75速度快✅ mlx-whisper
NVIDIA Parakeet TDT 1.1B~8.0超低延迟✅ 已有 MLX 版本

对于 Apple Silicon 用户,目前最实用的选择仍然是 mlx-whisper (turbo),生态成熟、安装简单。如果追求更低延迟,Parakeet TDT 也有 MLX 版本可以尝试。

清理提醒

Whisper 模型缓存很占空间。我的机器上发现了 6 个不同版本的模型缓存,总共 11.3GB。用完记得清理:

# 查看缓存大小
du -sh ~/.cache/huggingface/hub/models--*whisper*
du -sh ~/.cache/whisper/

# 按需删除不用的模型
rm -rf ~/.cache/huggingface/hub/models--不需要的模型
rm -rf ~/.cache/whisper/

总结

  1. Apple Silicon Mac 上跑 Whisper,必须用 mlx-whisper,否则纯 CPU 慢到不可用
  2. turbo(即 large-v3-turbo)是当前性价比最优的模型
  3. Whisper 开源版已停更,但 MLX 生态让它在 Mac 上依然是最方便的选择
  4. 用完记得清理模型缓存,轻松省下 10GB+ 空间

如果这篇文章对你有帮助,欢迎请我喝杯咖啡,支持我继续创作更多内容。

Buy me a coffee