导航

Faster-Whisper

Posted on 2024-02-26 13:51  蝈蝈俊  阅读(185)  评论(0编辑  收藏  举报

Faster-Whisper https://github.com/SYSTRAN/faster-whisper 是一个使用 CTranslate2 重新实现的 OpenAI Whisper 模型,旨在提高转录速度和效率。

它显著提高了处理速度,与原始 Whisper 模型相比,保持了相同的准确性的同时,速度提升了最多 4 倍,并且降低了内存使用量。

此外,它支持 CPU 和 GPU 上的 8 位量化,进一步优化效率。

安装

pip install faster-whisper

# 更新
pip install -U faster-whisper

CUDA 的安装

我试过直接下载https://developer.nvidia.com/cuda-downloads

或者

https://github.com/Purfview/whisper-standalone-win/releases/tag/libs 解压存档并将对应库放在 PATH 目录中。

都没成功,报:

cublas64_12.dll is not found

RuntimeError: Library cublas64_12.dll is not found or cannot be loaded

最后解决方案是通过下面命令安装的:

conda install cuda -c nvidia

相关文档参看: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html

模型安装目录

默认情况下,它自动下载的对应模型文件在local cached 目录下。

比如,我这里配置的使用 large-v3 模型(即 https://huggingface.co/Systran/faster-whisper-large-v3

model = WhisperModel("large-v3", device="cuda", compute_type="float16")

对应模型文件被下载在下面地址:

# mac
/Users/ghj1976/.cache/huggingface/hub/models--Systran--faster-whisper-large-v3

# win
C:\Users\Administrator.SY-202304151755\.cache\huggingface\hub\models--Systran--faster-whisper-large-v3

要升级模型也是升级对应的文件。