Highlights
模型为Paraformer语音识别-中文-通用-16k-离线的onnx量化导出版本,可以直接用来做生产部署,一键部署教程(点击此处)
模型转换及测试脚本
测试数据:https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/testaudio/asrexample_zh.pcm
from funasr_onnx import Paraformer
from pathlib import Path
model_dir = "damo/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8358-tensorflow1"
model = Paraformer(model_dir, batch_size=1, quantize=True)
wav_path = path_to_asr_example_zh
result = model(wav_path)
print(result)
model_dir
: model_name in modelscope or local path downloaded from modelscope. If the local path is set, it should containmodel.onnx
,config.yaml
,am.mvn
batch_size
:1
(Default), the batch size duration inferencedevice_id
:-1
(Default), infer on CPU. If you want to infer with GPU, set it to gpu_id (Please make sure that you have install the onnxruntime-gpu)quantize
:False
(Default), load the model ofmodel.onnx
inmodel_dir
. If setTrue
, load the model ofmodel_quant.onnx
inmodel_dir
intra_op_num_threads
:4
(Default), sets the number of threads used for intraop parallelism on CPU
参考教程:https://alibaba-damo-academy.github.io/FunASR/en/runtime/python/onnxruntime/README.html
相关论文以及引用信息
@inproceedings{gao2022paraformer,
title={Paraformer: Fast and Accurate Parallel Transformer for Non-autoregressive End-to-End Speech Recognition},
author={Gao, Zhifu and Zhang, Shiliang and McLoughlin, Ian and Yan, Zhijie},
booktitle={INTERSPEECH},
year={2022}
}
评论