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

更多内容欢迎访问博客

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

相关推荐
运维Linux和python2 分钟前
闲聊AI时代的焦虑
人工智能
墨白曦煜2 分钟前
RocketMQ 实战:揭秘 @RocketMQMessageListener 的反序列化魔法与“万能”消费策略
开发语言·python·rocketmq
智驱力人工智能2 分钟前
一盔一带AI抓拍系统能否破解非机动车执法取证难 骑行未戴头盔检测 电动车未戴头盔智能监测 摩托车头盔佩戴AI识别系统 边缘计算实时处理
人工智能·算法·yolo·目标检测·边缘计算
时空未宇3 分钟前
Hi3403开发板 + openEuler Embedded 部署 openClaw + 飞书
人工智能·openeuler·openclaw·hi3403
jay神6 分钟前
基于YOLOv8的无人机识别与检测系统
人工智能·深度学习·yolo·目标检测·毕业设计·无人机
皮卡丘不断更7 分钟前
我把传统项目问答升级成了 Agent-RAG:Spring Boot + FastAPI + ChromaDB 工程落地实践
人工智能·spring boot·后端·架构·python3.11
serve the people9 分钟前
BERT模型
人工智能·深度学习·bert
木斯佳9 分钟前
前端八股文面经大全:得物AI应用开发一面(2026-03-23)·面经深度解析【加精】
前端·人工智能·ai·markdown·chat·rag
绒绒毛毛雨1 小时前
On the Plasticity and Stability for Post-Training Large Language Models
人工智能·机器学习·语言模型
ZTLJQ8 小时前
序列化的艺术:Python JSON处理完全解析
开发语言·python·json