开源语音识别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参数

更多内容欢迎访问博客

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

相关推荐
CES_Asia14 小时前
亚洲科技话语权之争:CES Asia 2026核心展区席位进入收官阶段
大数据·人工智能·科技·物联网·机器人
一个会的不多的人14 小时前
人工智能基础篇:概念性名词浅谈(第十四讲)
人工智能·制造·数字化转型
Brduino脑机接口技术答疑14 小时前
TDCA 算法在 SSVEP 场景中:Padding 的应用对象与工程实践指南
人工智能·python·算法·数据分析·脑机接口·eeg
quant_198614 小时前
如何处理大规模行情数据:从源头到终端的实战教程
大数据·开发语言·经验分享·python·金融
程序员三藏14 小时前
白盒测试和黑盒测试详解
自动化测试·软件测试·python·功能测试·测试工具·职场和发展·测试用例
玄同76514 小时前
Python 装饰器:LLM API 的安全与可观测性增强
开发语言·人工智能·python·安全·自然语言处理·numpy·装饰器
房产中介行业研习社14 小时前
市面上比较主流的房产中介管理系统有哪些推荐?
大数据·人工智能·房产直播技巧·房产直播培训
学习3人组14 小时前
目标检测模型选型+训练调参极简步骤清单
人工智能·目标检测·决策树
Yeats_Liao14 小时前
MindSpore开发之路(十七):静态图 vs. 动态图:掌握MindSpore的两种执行模式
人工智能·深度学习·机器学习
keep_learning11114 小时前
Z-Image模型架构全解析
人工智能·算法·计算机视觉·大模型·多模态