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

1. 资源下载

源码地址

模型下载地址:

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

https://github.com/Purfview/whisper-standalone-win/releases/tag/libs

2. 创建环境

conda环境中创建python运行环境

conda create -n faster_whisper python=3.9 # python版本要求3.8到3.11

激活虚拟环境

conda activate faster_whisper

安装faster-whisper依赖

pip install faster-whisper

3. 运行

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

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))

说明:

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. 开源语音识别faster-whisper部署教程

    2023-12-18 07:30:02       41 阅读
  2. [语音识别]开源语音识别faster-whisper模型下载地址

    2023-12-18 07:30:02       39 阅读
  3. Whisper——部署fast-whisper中文语音识别模型

    2023-12-18 07:30:02       40 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-18 07:30:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-18 07:30:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-18 07:30:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-18 07:30:02       18 阅读

热门阅读

  1. C# 内存的分配管理

    2023-12-18 07:30:02       40 阅读
  2. React 表单与事件

    2023-12-18 07:30:02       36 阅读
  3. 第二十章 : Spring Boot 集成RabbitMQ(四)

    2023-12-18 07:30:02       44 阅读
  4. 解决spa页面首屏加载慢的方式笔记

    2023-12-18 07:30:02       41 阅读
  5. 解决阿里云ECS磁盘在线扩容不生效

    2023-12-18 07:30:02       41 阅读
  6. 微服务Redis-Session共享登录状态

    2023-12-18 07:30:02       27 阅读
  7. centos-静态ip及修改主机名

    2023-12-18 07:30:02       35 阅读
  8. 【React基础三】组件传值、高阶组件、Hook

    2023-12-18 07:30:02       37 阅读
  9. 如何使用ffmpeg高效的压缩视频

    2023-12-18 07:30:02       40 阅读
  10. C语言学习day09:运算符(下)

    2023-12-18 07:30:02       37 阅读
  11. 【Vue3练习】Vue3使用v-model以及多个v-model

    2023-12-18 07:30:02       36 阅读
  12. vue模板语法

    2023-12-18 07:30:02       35 阅读
  13. 数据结构 | 二叉树的遍历(递归&非递归)

    2023-12-18 07:30:02       34 阅读
  14. 【NeurIPS 2023】多模态联合视频生成大模型CoDi

    2023-12-18 07:30:02       45 阅读