From 4e83b3473b5bbe30138c340dd7e3af3e5e93234a Mon Sep 17 00:00:00 2001 From: luffy <610636393@qq.com> Date: Tue, 18 Feb 2025 12:34:47 +0800 Subject: [PATCH] speaker-identification-with-vad-non-streaming-asr.py Lack of support for sense_voice. (#1884) --- ...-identification-with-vad-non-streaming-asr.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python-api-examples/speaker-identification-with-vad-non-streaming-asr.py b/python-api-examples/speaker-identification-with-vad-non-streaming-asr.py index f76e43fb..cca36360 100755 --- a/python-api-examples/speaker-identification-with-vad-non-streaming-asr.py +++ b/python-api-examples/speaker-identification-with-vad-non-streaming-asr.py @@ -185,6 +185,13 @@ def register_non_streaming_asr_model_args(parser): help="Feature dimension. Must match the one expected by the model", ) + parser.add_argument( + "--sense-voice", + default="", + type=str, + help="Path to sense voice model", + ) + def get_args(): parser = argparse.ArgumentParser( @@ -317,6 +324,15 @@ def create_recognizer(args) -> sherpa_onnx.OfflineRecognizer: task=args.whisper_task, tail_paddings=args.whisper_tail_paddings, ) + elif args.sense_voice: + assert_file_exists(args.sense_voice) + recognizer = sherpa_onnx.OfflineRecognizer.from_sense_voice( + model=args.sense_voice, + tokens=args.tokens, + num_threads=args.num_threads, + use_itn=True, + debug=args.debug, + ) else: raise ValueError("Please specify at least one model")