From 0a7c0661b13e299f68c458d19fc766839cd01bfb Mon Sep 17 00:00:00 2001 From: lzr265946 <lzr265946@alibaba-inc.com> Date: 星期一, 13 二月 2023 11:38:32 +0800 Subject: [PATCH] add paraformer-large-contextual egs_modelscope --- egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/README.md | 19 +++++++++++++++++++ egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/infer.py | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-) diff --git a/egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/README.md b/egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/README.md new file mode 100644 index 0000000..49c0aeb --- /dev/null +++ b/egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/README.md @@ -0,0 +1,19 @@ +# ModelScope Model + +## How to infer using a pretrained Paraformer-large Model + +### Inference + +You can use the pretrain model for inference directly. + +- Setting parameters in `infer.py` + - <strong>audio_in:</strong> # Support wav, url, bytes, and parsed audio format. + - <strong>output_dir:</strong> # If the input format is wav.scp, it needs to be set. + - <strong>batch_size:</strong> # Set batch size in inference. + - <strong>param_dict:</strong> # Set the hotword list in inference. + +- Then you can run the pipeline to infer with: +```python + python infer.py +``` + diff --git a/egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/infer.py b/egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/infer.py new file mode 100644 index 0000000..78fb8f1 --- /dev/null +++ b/egs_modelscope/asr/paraformer/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404/infer.py @@ -0,0 +1,21 @@ +from modelscope.pipelines import pipeline +from modelscope.utils.constant import Tasks + + +if __name__ == '__main__': + param_dict = dict() + param_dict['hotword'] = "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/hotword.txt" + + audio_in = "//isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_hotword.wav" + output_dir = None + batch_size = 1 + + inference_pipeline = pipeline( + task=Tasks.auto_speech_recognition, + model="damo/speech_paraformer-large-contextual_asr_nat-zh-cn-16k-common-vocab8404", + output_dir=output_dir, + batch_size=batch_size, + param_dict=param_dict) + + rec_result = inference_pipeline(audio_in=audio_in) + print(rec_result) -- Gitblit v1.9.1