0


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、库安装

  1. pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118
  2. pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  3. pip install funasr-onnx gradio -i https://pypi.tuna.tsinghua.edu.cn/simple

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

apt install ffmpeg

3、SenseVoiceSmall模型下载

  1. git lfs install
  2. git clone https://www.modelscope.cn/iic/SenseVoiceSmall.git

、功能测试

1、运行测试

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

  1. from model import SenseVoiceSmall
  2. import time
  3. import argparse
  4. class VoiceRecognitionModel:
  5. def __init__(self, model_dir="SenseVoiceSmall", device="cpu"):
  6. self.model_dir = model_dir
  7. self.device = device
  8. self.model, self.kwargs = SenseVoiceSmall.from_pretrained(model=self.model_dir, device=self.device)
  9. def infer(self, input_file, language="auto", use_itn=False):
  10. start_time = time.time()
  11. result = self.model.inference(
  12. data_in=input_file,
  13. language=language,
  14. use_itn=use_itn,
  15. **self.kwargs,
  16. )
  17. elapsed_time_ms = (time.time() - start_time) * 1000
  18. print(f"tts time: {elapsed_time_ms:.2f} ms")
  19. return result
  20. if name == "__main__":
  21. parser = argparse.ArgumentParser()
  22. parser.add_argument('--voice', type=str, default='voice/test1.wav', help='Path to the voice')
  23. args = parser.parse_args()
  24. model_dir="SenseVoiceSmall"
  25. device="cpu"
  26. recognizer = VoiceRecognitionModel(model_dir, device)
  27. result = recognizer.infer(args.voice)
  28. print(result)

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

未完......

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


本文转载自: https://blog.csdn.net/m0_71062934/article/details/140423005
版权归原作者 杰说新技术 所有, 如有侵权,请联系我们删除。

“SenseVoice多语言语音理解模型之最新部署落地经验”的评论:

还没有评论