mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
* actions demo * add unittest * add info for test * fix yml * fix yml * test log * remove demo action * change logger * readme * add unittest * add info for test * fix yml * fix yml * test log * remove demo action * change logger * readme * Update asr_utils.py * readme * infer with tag 1.1.6 * readme * onnxruntime * onnxruntime * timestamp func bug fix * support grpc+onnxruntime * onnxruntime * Add code of generating whl about rapid_paraformer * Fix README path error * onnxruntime * onnxruntime * add transformerLM egs(aishell2) * onnxruntime * onnxruntime * support hotword parameter passing in the pipeline forward * onnxruntime * modify onnxruntime environment dependencies * onnxruntime * 0.2.1 * fbank online * fbank online * fbank online * fbank online * fbank online * Add sentence timestamp support Added support for statement event timestamp, which is particularly useful for applications such as lyrics and subtitles. * fbank online * bugfix * readme * update docs * update docs * update docs * fix uniasr decoding bug * modify contextual hotword parameter * onnx * onnx * onnx * onnx * onnx export * onnx export * fix data dir filter bug * in_cache & support soundfile read * v0.2.2 * egs recipe asr vad punc * egs recipe asr vad punc * add training related code for sond * add scripts for simu data * add scripts for simu data * add scripts for simu data * add scripts for simu data * add scripts for simu data * add scripts for simu data * add scripts for simu data * add scripts for simu data * add scripts for simu data * simu data * simu data * simu data * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * sond pipeline * fixbug for sd and sv * fixbug for sd and sv * fixbug for sd and sv * fixbug sond initial * fixbug sond initial * fixbug sond initial * unit test modelscope for sd * unit test modelscope for sd * unit test modelscope for sd * unit test modelscope for sd * update cif onnx * onnx supports tiny and bicif paraformer * add triton * add README * torch version * Update README.md * Update README.md * gpu bug fix * update vad inference --------- Co-authored-by: xiaozy <xiaozy@xiaozy-MacBook.local> Co-authored-by: 游雁 <zhifu.gzf@alibaba-inc.com> Co-authored-by: hnluo <haoneng.lhn@alibaba-inc.com> Co-authored-by: 九耳 <mengzhe.cmz@alibaba-inc.com> Co-authored-by: shixian.shi <shixian.shi@alibaba-inc.com> Co-authored-by: 北念 <lzr265946@alibaba-inc.com> Co-authored-by: SWHL <liekkaskono@163.com> Co-authored-by: wucong.lyb <wucong.lyb@alibaba-inc.com> Co-authored-by: dingbig <dingbig@gmail.com> Co-authored-by: speech_asr <wangjiaming.wjm@alibaba-inc.com> Co-authored-by: 凌匀 <ailsa.zly@alibaba-inc.com> Co-authored-by: 志浩 <neo.dzh@alibaba-inc.com> Co-authored-by: root <zhangyuekai@foxmail.com> Co-authored-by: jiangyu.xzy <jiangyu.xzy@alibaba-inc.com>
48 lines
2.0 KiB
Python
48 lines
2.0 KiB
Python
import unittest
|
|
|
|
from modelscope.pipelines import pipeline
|
|
from modelscope.utils.constant import Tasks
|
|
from modelscope.utils.logger import get_logger
|
|
|
|
logger = get_logger()
|
|
|
|
class TestInferencePipelines(unittest.TestCase):
|
|
def test_funasr_path(self):
|
|
import funasr
|
|
import os
|
|
logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__))
|
|
|
|
def test_asr_inference_pipeline(self):
|
|
inference_pipeline = pipeline(
|
|
task=Tasks.auto_speech_recognition,
|
|
model='damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch')
|
|
rec_result = inference_pipeline(
|
|
audio_in='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav')
|
|
logger.info("asr inference result: {0}".format(rec_result))
|
|
|
|
def test_asr_inference_pipeline_with_vad_punc(self):
|
|
inference_pipeline = pipeline(
|
|
task=Tasks.auto_speech_recognition,
|
|
model='damo/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch',
|
|
vad_model='damo/speech_fsmn_vad_zh-cn-16k-common-pytorch',
|
|
vad_model_revision="v1.1.8",
|
|
punc_model='damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch',
|
|
punc_model_revision="v1.1.6")
|
|
rec_result = inference_pipeline(
|
|
audio_in='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_vad_punc_example.wav')
|
|
logger.info("asr inference with vad punc result: {0}".format(rec_result))
|
|
|
|
def test_vad_inference_pipeline(self):
|
|
inference_pipeline = pipeline(
|
|
task=Tasks.voice_activity_detection,
|
|
model='damo/speech_fsmn_vad_zh-cn-16k-common-pytorch',
|
|
model_revision='v1.1.8',
|
|
)
|
|
segments_result = inference_pipeline(
|
|
audio_in='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav')
|
|
logger.info("vad inference result: {0}".format(segments_result))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|