开源语音识别faster-whisper部署教程

1. 资源下载

源码地址

模型下载地址:

markdown 复制代码
large-v3模型:https://huggingface.co/Systran/faster-whisper-large-v3/tree/main
large-v2模型:https://huggingface.co/guillaumekln/faster-whisper-large-v2/tree/main
large-v2模型:https://huggingface.co/guillaumekln/faster-whisper-large-v1/tree/main
medium模型:https://huggingface.co/guillaumekln/faster-whisper-medium/tree/main
small模型:https://huggingface.co/guillaumekln/faster-whisper-small/tree/main
base模型:https://huggingface.co/guillaumekln/faster-whisper-base/tree/main
tiny模型:https://huggingface.co/guillaumekln/faster-whisper-tiny/tree/main

下载cuBLAS and cuDNN

shell 复制代码
https://github.com/Purfview/whisper-standalone-win/releases/tag/libs

2. 创建环境

conda环境中创建python运行环境

shell 复制代码
conda create -n faster_whisper python=3.9 # python版本要求3.8到3.11

激活虚拟环境

shell 复制代码
conda activate faster_whisper

安装faster-whisper依赖

shell 复制代码
pip install faster-whisper

3. 运行

执行完以上步骤后,我们可以写代码了

python 复制代码
from faster_whisper import WhisperModel

model_size = "large-v3"

path = r"D:\Works\Python\Faster_Whisper\model\small"

# Run on GPU with FP16
model = WhisperModel(model_size_or_path=path, device="cuda", local_files_only=True)

# or run on GPU with INT8
# model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
# or run on CPU with INT8
# model = WhisperModel(model_size, device="cpu", compute_type="int8")

segments, info = model.transcribe("C:\\Users\\21316\\Documents\\录音\\test.wav", beam_size=5, language="zh", vad_filter=True, vad_parameters=dict(min_silence_duration_ms=1000))

print("Detected language '%s' with probability %f" % (info.language, info.language_probability))

for segment in segments:
    print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))

说明:

markdown 复制代码
local_files_only=True 表示加载本地模型
model_size_or_path=path 指定加载模型路径
device="cuda" 指定使用cuda
compute_type="int8_float16" 量化为8位
language="zh" 指定音频语言
vad_filter=True 开启vad
vad_parameters=dict(min_silence_duration_ms=1000) 设置vad参数

更多内容欢迎访问博客

对应视频内容欢迎访问视频

相关推荐
王者鳜錸2 分钟前
基于Selenium和AI的图像处理
图像处理·人工智能·selenium
ColderYY4 分钟前
DrissionPage自动化
python·自动化
song150265372985 分钟前
全检垫圈垫片 视觉检测设备 在线自动化瑕疵检测机
人工智能·自动化·视觉检测
Python大数据分析@7 分钟前
如何用 Python xlwings库自动化操作 Excel?
python·自动化·excel
song1502653729810 分钟前
铜鼻子冷压端子视觉检测机 尺寸外观瑕疵自动化检测设备
人工智能·自动化·视觉检测
wzx_Eleven14 分钟前
【论文阅读】AAAI 2025 | 面向精确分割式联邦学习的多模型聚合与知识重放
论文阅读·人工智能·机器学习
Zack_Liu15 分钟前
LSS论文阅读
论文阅读·人工智能·目标跟踪
张较瘦_18 分钟前
[论文阅读] AI + Debug | 基于大语言模型的GitHub故障复现测试用例生成方法解析
论文阅读·人工智能·语言模型
Small___ming18 分钟前
【论文笔记】扩散模型——如何通俗理解传统概率模型的核心矛盾
论文阅读·人工智能·扩散模型·生成式人工智能
时序之心18 分钟前
时序论文速递:覆盖时间序列预测、分类、异常检测及交叉应用!(10.20-10.24)
人工智能·分类·数据挖掘·论文·时间序列