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

更多内容欢迎访问博客

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

相关推荐
微三云云仔1 分钟前
2026东莞品牌营销排名观察:从传统咨询到GEO,企业如何选对增长伙伴
大数据·人工智能·geo·ai搜索优化·微三云
OxYGC26 分钟前
大模型智能体-大模型概述
人工智能·语音识别
ZhengEnCi1 小时前
AI 操作电脑触发 UAC 后误判没弹窗:动作发出后要等状态收敛再截图
人工智能·aigc·ai编程
林晓lx1 小时前
【程序员AI课】神经网络基础(上):用显微镜观察一个神经元(九)
人工智能·深度学习·神经网络
miumiuwa1 小时前
解剖一个真实上线的 AI Skill:医学测试用例生成器的设计与取舍
人工智能·测试用例
钱栈up2 小时前
GitHub热榜实测|Sherlock:一个用户名搜遍全网
python·开源·github
AAA修煤气灶刘哥2 小时前
Agent 面试题|上下文压缩怎么兼顾 token 开销和决策效果?
人工智能·后端·面试
geovindu2 小时前
python: Gradient Boosting
开发语言·后端·python·算法·boosting
AAA修煤气灶刘哥2 小时前
Agent 面试题|工具调用结果不符合预期,什么时候该重规划?
人工智能·后端·面试