语音识别_Faster_Whisper_Base

我要开发同款
匿名用户2024年07月31日
36阅读
所属分类aiPytorch
开源地址https://modelscope.cn/models/yuanjian/kry_faster_whisper
授权协议Apache License 2.0

作品详情


faster_whisper base模型

frameworks:

  • Pytorch license: Apache License 2.0 tasks:
  • auto-speech-recognition

SDK下载

#安装ModelScope
pip install modelscope
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('yuanjian/kry_faster_whisper')

Git下载

#Git模型下载
git clone https://www.modelscope.cn/yuanjian/kry_faster_whisper.git

使用模型

#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('yuanjian/kry_faster_whisper')

from faster_whisper import WhisperModel
import time

def transcribe(model, audio_path):
    st = time.time()
    segments, info = model.transcribe(audio_path)
    segments = list(segments)
    print('识别文件: ', audio_path, ' 耗时:', time.time() - st)
    for segment in segments:
        print("识别结果:[%s]" % (segment.text))

def test():
    st = time.time()
    print("load model ...")
    # Run on GPU with FP16
    model = WhisperModel(model_dir, device="cuda", compute_type="float16")
    # Run on GPU with INT8 
    # model = WhisperModel(model_dir, device="cuda", compute_type="int8_float16")
    # Run on CPU with INT8
    # model = WhisperModel(model_dir, device="cpu", compute_type="int8")
    print('load model cost:', time.time() - st)

    transcribe(model, "three_fangyan.m4a")



test()

如果您是本模型的贡献者,我们邀请您根据模型贡献文档,及时完善模型卡片内容。

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论