k2-fsa / sherpa-onnx

Speech-to-text, text-to-speech, speaker recognition, and VAD using next-gen Kaldi with onnxruntime without Internet connection. Support embedded systems, Android, iOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust
https://k2-fsa.github.io/sherpa/onnx/index.html
Apache License 2.0
3.24k stars 378 forks source link

sherpa-onnx-streaming-paraformer-bilingual-zh-en 模型 用麦克风流式推理 经常会漏掉最后一个字 #1373

Open Text2-m opened 1 week ago

Text2-m commented 1 week ago

6_介绍一下巡检机器_1727156347.7198553.zip

csukuangfj commented 1 week ago

请用文字和代码描述如何复现

Text2-m commented 1 week ago

脚本参考 python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py 把加载模型换成了paraformer的,把麦克风拾到音保存了音频文件我听着,还挺清楚的,基本上漏掉最后一个字的概率有50% def create_recognizer(args): assert_file_exists(args.encoder) assert_file_exists(args.decoder) assert_file_exists(args.tokens)

Please replace the model files if needed.

# See https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html
# for download links.
recognizer = sherpa_onnx.OnlineRecognizer.from_paraformer(
    tokens=args.tokens,
    encoder=args.encoder,
    decoder=args.decoder,
    num_threads=1,
    sample_rate=16000,
    feature_dim=80,
    enable_endpoint_detection=True,
    rule1_min_trailing_silence=2.4,
    rule2_min_trailing_silence=1.2,
    rule3_min_utterance_length=300,  # it essentially disables this rule
    decoding_method=args.decoding_method,
    provider=args.provider,
)
return recognizer
csukuangfj commented 1 week ago

https://github.com/k2-fsa/sherpa-onnx/blob/master/python-api-examples/streaming-paraformer-asr-microphone.py

你要用这个脚本

Text2-m commented 1 week ago

用你这个脚本,也漏最后一个字

https://github.com/k2-fsa/sherpa-onnx/blob/master/python-api-examples/streaming-paraformer-asr-microphone.py

你要用这个脚本

csukuangfj commented 1 week ago

那你用 build/bin 下面的 sherpa-onnx-microphone 测试呢?

看了下, python 的例子代码里,没有在 endpoint 的时候,再加一些 padding.

C++ 例子代码,有加的

https://github.com/k2-fsa/sherpa-onnx/blob/d8809b520ee3824b8dea139270c14d98f50ad0b9/sherpa-onnx/csrc/sherpa-onnx-microphone.cc#L186-L197


还有,流式模型,建议用 https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english

Text2-m commented 1 week ago

那你用 build/bin 下面的 sherpa-onnx-microphone 测试呢?

看了下, python 的例子代码里,没有在 endpoint 的时候,再加一些 padding.

C++ 例子代码,有加的

https://github.com/k2-fsa/sherpa-onnx/blob/d8809b520ee3824b8dea139270c14d98f50ad0b9/sherpa-onnx/csrc/sherpa-onnx-microphone.cc#L186-L197

还有,流式模型,建议用 https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english

你们的模型是这个吗 https://modelscope.cn/models/iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-online-onnx/files ,如果不是用这个onnx的模型能推理吗,我看这个模型训练用了6w小时的数据

Text2-m commented 1 week ago

还有一个问题,paraformer推理做padding 是不是端点处往后再录入一秒的音频推理就行了?

csukuangfj commented 1 week ago
  1. 我们提供的所有 paraformer 预训练模型,都是来自 funasr。具体哪个对应那个,请自己去我们的文档里找。

还有一个问题,paraformer推理做padding 是不是端点处往后再录入一秒的音频推理就行了?

可以的。上面已经告诉你如何做了,不知道你去试了没?如果试了的话,应该就没有问题了。

Text2-m commented 1 week ago

好的,感谢

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: Fangjun Kuang @.> 发送时间: 2024年9月25日 19:44 收件人: k2-fsa/sherpa-onnx @.> 抄送: zm_11 @.>, Author @.> 主题: Re: [k2-fsa/sherpa-onnx] sherpa-onnx-streaming-paraformer-bilingual-zh-en 模型 用麦克风流式推理 经常会漏掉最后一个字 (Issue #1373)

我们提供的所有 paraformer 预训练模型,都是来自 funasr。具体哪个对应那个,请自己去我们的文档里找。

还有一个问题,paraformer推理做padding 是不是端点处往后再录入一秒的音频推理就行了?

可以的。上面已经告诉你如何做了,不知道你去试了没?如果试了的话,应该就没有问题了。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>