SenseVoice多语言语音理解模型之最新部署落地经验

SenseVoice是阿里云通义实验室开发的一款多语言音频基础模型,专注于高精度多语言语音识别、情感辨识和音频事件检测。

SenseVoice支持超过50种语言的识别,并且在中文和粤语上的识别效果优于Whisper模型,提升了50%以上。

SenseVoice具备强大的情感识别能力,能够检测音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件。

SenseVoice模型在推理速度上表现出色,其小型模型SenseVoice-Small采用非自回归端到端框架,10秒音频的推理时间仅为70毫秒,比Whisper-large快15倍。

github项目地址:https://github.com/FunAudioLLM/SenseVoice。

一、环境安装

1、python环境

建议安装python版本在3.10以上。

2、库安装

pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install funasr-onnx gradio -i https://pypi.tuna.tsinghua.edu.cn/simple

为了方便音频处理,还需要安装ffmpeg,命令如下:

apt install ffmpeg

3、SenseVoiceSmall模型下载

git lfs install

git clone https://www.modelscope.cn/iic/SenseVoiceSmall.git

、功能测试

1、运行测试

(1)通过官方model代码进行调用测试

from model import SenseVoiceSmall

import time

import argparse



class VoiceRecognitionModel:

def __init__(self, model_dir="SenseVoiceSmall", device="cpu"):

self.model_dir = model_dir

self.device = device

self.model, self.kwargs = SenseVoiceSmall.from_pretrained(model=self.model_dir, device=self.device)



def infer(self, input_file, language="auto", use_itn=False):

start_time = time.time()

result = self.model.inference(

data_in=input_file,

language=language,

use_itn=use_itn,

**self.kwargs,

)

elapsed_time_ms = (time.time() - start_time) * 1000

print(f"tts time: {elapsed_time_ms:.2f} ms")

return result



if name == "__main__":

parser = argparse.ArgumentParser()

parser.add_argument('--voice', type=str, default='voice/test1.wav', help='Path to the voice')

args = parser.parse_args()

model_dir="SenseVoiceSmall"

device="cpu"

recognizer = VoiceRecognitionModel(model_dir, device)

result = recognizer.infer(args.voice)

print(result)

(2)通过funasr进行调用测试

未完......

更多详细的内容欢迎关注:杰哥新技术

  • 7
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值