less than 1 minute read

FunASR 是一个基础语音识别工具包,提供多种功能,包括语音识别(ASR)、语音端点检测(VAD)、标点恢复、语言模型、说话人验证、说话人分离和多人对话语音识别等。

FunASR 快速入门

FunASR 镜像

  • 在线 CPU 版本
docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.13
  • 离线 GPU 版本
docker pull registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-gpu-0.2.1

运行容器

创建模型存储目录

mkdir -p ~/GitHub/FunASR/funasr-runtime-resources/models

运行容器

docker run -p 10095:10095 -it --name funasr --privileged=true \
  -v ~/GitHub/FunASR/funasr-runtime-resources/models:/workspace/models \
  registry.cn-hangzhou.aliyuncs.com/funasr_repo/funasr:funasr-runtime-sdk-online-cpu-0.1.13 \
  bash

容器内部署

安装 ffmpeg

apt update && apt install ffmpeg -y

运行服务

cd FunASR/runtime

bash run_server_2pass.sh \
  --download-model-dir /workspace/models \
  --vad-dir damo/speech_fsmn_vad_zh-cn-16k-common-onnx \
  --model-dir damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-onnx \
  --online-model-dir damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx \
  --punc-dir damo/punc_ct-transformer_zh-cn-common-vad_realtime-vocab272727-onnx \
  --lm-dir damo/speech_ngram_lm_zh-cn-ai-wesp-fst \
  --itn-dir thuduj12/fst_itn_zh \
  --hotword /workspace/models/hotwords.txt \
  --certfile 0

测试

下载例子

wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/sample/funasr_samples.tar.gz
tar xzvf funasr_samples.tar.gz

打开客户端

open samples/html/static/index.html

模型

模型 本地缓存路径 说明
paraformer-zh-streaming ~/.cache/modelscope/hub/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online 大型中文在线语音识别模型
paraformer-zh ~/.cache/modelscope/hub/models/iic/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch 大型中文语音识别模型
fsmn-vad ~/.cache/modelscope/hub/models/iic/speech_fsmn_vad_zh-cn-16k-common-pytorch 中文语音端点检测模型
ct-punc ~/.cache/modelscope/hub/models/iic/punc_ct-transformer_cn-en-common-vocab471067-large 中英文标点恢复模型
cam++ ~/.cache/modelscope/hub/models/iic/speech_campplus_sv_zh-cn_16k-common 中文说话人验证模型

Updated: