Closed Caet-pip closed 1 year ago
Please refer to 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 to download the model.
By the way, please first read the error logs. You can also find the fix from the error logs.
Yeah, I overlooked that I downloaded the model and its working now but I got a protobuf error
I had earlier installed with brew install protobuf
(base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % python3 ./python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py \ --tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \ --encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \ --decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \ --joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx
0 Bunpods - Find My, Core Audio (1 in, 0 out) < 1 Bunpods - Find My, Core Audio (0 in, 2 out) 2 MacBook Pro Microphone, Core Audio (1 in, 0 out) 3 MacBook Pro Speakers, Core Audio (0 in, 2 out) Use default device: Bunpods - Find My Traceback (most recent call last): File "/Users/fawazahamedshaik/sherpa-onnx/./python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py", line 142, in
main() File "/Users/fawazahamedshaik/sherpa-onnx/./python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py", line 101, in main recognizer = create_recognizer() File "/Users/fawazahamedshaik/sherpa-onnx/./python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py", line 83, in create_recognizer recognizer = sherpa_onnx.OnlineRecognizer( File "/Users/fawazahamedshaik/opt/anaconda3/lib/python3.9/site-packages/sherpa_onnx/online_recognizer.py", line 129, in init self.recognizer = _Recognizer(recognizer_config) RuntimeError: Failed to load model because protobuf parsing failed.
What is the output of
ls -lh sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
Please make sure you followed exactly the documentation to download the model.
That is, you did not miss git lfs pull
, described explicitly in the documentation.
I got this error when I did git lfs pull git: 'lfs' is not a git command. See 'git --help'.
The most similar command is log
output of : ls -lh sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 is
(base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % ls -lh sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
total 208
-rw-r--r-- 1 fawazahamedshaik staff 296B Jun 12 23:47 README.md
-rw-r--r-- 1 fawazahamedshaik staff 133B Jun 12 23:47 decoder-epoch-99-avg-1.int8.onnx
-rw-r--r-- 1 fawazahamedshaik staff 133B Jun 12 23:47 decoder-epoch-99-avg-1.onnx
-rw-r--r-- 1 fawazahamedshaik staff 134B Jun 12 23:47 encoder-epoch-99-avg-1.int8.onnx
-rw-r--r-- 1 fawazahamedshaik staff 134B Jun 12 23:47 encoder-epoch-99-avg-1.onnx
-rwxr-xr-x 1 fawazahamedshaik staff 713B Jun 12 23:47 export-onnx-stateless7-streaming-zh.sh
-rw-r--r-- 1 fawazahamedshaik staff 132B Jun 12 23:47 joiner-epoch-99-avg-1.int8.onnx
-rw-r--r-- 1 fawazahamedshaik staff 133B Jun 12 23:47 joiner-epoch-99-avg-1.onnx
-rw-r--r-- 1 fawazahamedshaik staff 132B Jun 12 23:47 no-state-epoch-99-avg-1.int8.onnx
-rw-r--r-- 1 fawazahamedshaik staff 133B Jun 12 23:47 no-state-epoch-99-avg-1.onnx
drwxr-xr-x 7 fawazahamedshaik staff 224B Jun 12 23:47 test_wavs
-rw-r--r-- 1 fawazahamedshaik staff 55K Jun 12 23:47 tokens.txt
-rw-r--r-- 1 fawazahamedshaik staff 132B Jun 12 23:47 with-state-epoch-999-avg-1.int8.onnx
-rw-r--r-- 1 fawazahamedshaik staff 133B Jun 12 23:47 with-state-epoch-999-avg-1.onnx
brew install git-lfs
and then re-download the model.
Please don't ignore any errors when you download the model.
I followed the guide and got the following output when downloading model
(base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
git lfs pull --include "*.onnx"
Cloning into 'sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 47 (delta 9), reused 8 (delta 4), pack-reused 17
Unpacking objects: 100% (47/47), 1.38 MiB | 17.51 MiB/s, done.
Skipping object checkout, Git LFS is not installed for this repository.
Consider installing it with 'git lfs install'.
then I checked size with ls -lh *.onnx and got
-rw-r--r-- 1 fawazahamedshaik staff 133B Jun 13 00:03 decoder-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 fawazahamedshaik staff 133B Jun 13 00:03 decoder-epoch-99-avg-1.onnx -rw-r--r-- 1 fawazahamedshaik staff 134B Jun 13 00:03 encoder-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 fawazahamedshaik staff 134B Jun 13 00:03 encoder-epoch-99-avg-1.onnx -rw-r--r-- 1 fawazahamedshaik staff 132B Jun 13 00:03 joiner-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 fawazahamedshaik staff 133B Jun 13 00:03 joiner-epoch-99-avg-1.onnx -rw-r--r-- 1 fawazahamedshaik staff 132B Jun 13 00:03 no-state-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 fawazahamedshaik staff 133B Jun 13 00:03 no-state-epoch-99-avg-1.onnx -rw-r--r-- 1 fawazahamedshaik staff 132B Jun 13 00:03 with-state-epoch-999-avg-1.int8.onnx -rw-r--r-- 1 fawazahamedshaik staff 133B Jun 13 00:03 with-state-epoch-999-avg-1.onnx
which is not matching with
sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20$ ls -lh *.onnx -rw-r--r-- 1 kuangfangjun root 13M Mar 31 21:11 decoder-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 kuangfangjun root 14M Feb 20 20:13 decoder-epoch-99-avg-1.onnx -rw-r--r-- 1 kuangfangjun root 174M Mar 31 21:11 encoder-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 kuangfangjun root 315M Feb 20 20:13 encoder-epoch-99-avg-1.onnx -rw-r--r-- 1 kuangfangjun root 3.1M Mar 31 21:11 joiner-epoch-99-avg-1.int8.onnx -rw-r--r-- 1 kuangfangjun root 13M Feb 20 20:13 joiner-epoch-99-avg-1.onnx
when I try to decode a single wav file I am again getting same error
(base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % ./build/bin/sherpa-onnx \ --tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \ --encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \ --decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \ --joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx \ ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/test_wavs/1.wav /Users/fawazahamedshaik/sherpa-onnx/sherpa-onnx/csrc/parse-options.cc:Read:361 ./build/bin/sherpa-onnx --tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt --encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx --decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx --joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/test_wavs/1.wav
OnlineRecognizerConfig(feat_config=FeatureExtractorConfig(sampling_rate=16000, feature_dim=80), model_config=OnlineTransducerModelConfig(encoder_filename="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx", decoder_filename="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx", joiner_filename="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx", tokens="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt", num_threads=2, provider="cpu", debug=False), lm_config=OnlineLMConfig(model="", scale=0.5), endpoint_config=EndpointConfig(rule1=EndpointRule(must_contain_nonsilence=False, min_trailing_silence=2.4, min_utterance_length=0), rule2=EndpointRule(must_contain_nonsilence=True, min_trailing_silence=1.2, min_utterance_length=0), rule3=EndpointRule(must_contain_nonsilence=False, min_trailing_silence=0, min_utterance_length=20)), enable_endpoint=True, max_active_paths=4, decoding_method="greedy_search") libc++abi: terminating due to uncaught exception of type Ort::Exception: Failed to load model because protobuf parsing failed. zsh: abort ./build/bin/sherpa-onnx
Have you installed git-lfs
?
I re-did all the previous steps in order and was able to install and got the output for the test
(base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % ./build/bin/sherpa-onnx \
--tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \
--encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \
--decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \
--joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx \
./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/test_wavs/1.wav
/Users/fawazahamedshaik/sherpa-onnx/sherpa-onnx/csrc/parse-options.cc:Read:361 ./build/bin/sherpa-onnx --tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt --encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx --decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx --joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/test_wavs/1.wav
OnlineRecognizerConfig(feat_config=FeatureExtractorConfig(sampling_rate=16000, feature_dim=80), model_config=OnlineTransducerModelConfig(encoder_filename="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx", decoder_filename="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx", joiner_filename="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx", tokens="./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt", num_threads=2, provider="cpu", debug=False), lm_config=OnlineLMConfig(model="", scale=0.5), endpoint_config=EndpointConfig(rule1=EndpointRule(must_contain_nonsilence=False, min_trailing_silence=2.4, min_utterance_length=0), rule2=EndpointRule(must_contain_nonsilence=True, min_trailing_silence=1.2, min_utterance_length=0), rule3=EndpointRule(must_contain_nonsilence=False, min_trailing_silence=0, min_utterance_length=20)), enable_endpoint=True, max_active_paths=4, decoding_method="greedy_search") ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/test_wavs/1.wav Elapsed seconds: 0.38, Real time factor (RTF): 0.075 这是第一种第二种叫呃与 ALWAYS ALWAYS什么意思啊 {"is_final":false,"segment":0,"start_time":0.0,"text":"这是第一种第二种叫呃与 ALWAYS ALWAYS什么意思啊","timestamps":"[0.96, 1.04, 1.28, 1.40, 1.48, 1.72, 1.84, 2.04, 2.44, 3.24, 3.60, 3.84, 4.36, 4.72, 4.76, 4.92, 5.04, 5.08]","tokens":["这","是","第","一","种","第","二","种","叫","呃","与"," ALWAYS"," ALWAYS","什","么","意","思","啊"]}
I want to run the microphone demo but when I run it, it exits unexpectedly I used both python 3 and python
logs for python 3 (base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % python3 ./python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py \ --tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \ --encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \ --decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \ --joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx
0 Bunpods - Find My, Core Audio (1 in, 0 out) < 1 Bunpods - Find My, Core Audio (0 in, 2 out) 2 MacBook Pro Microphone, Core Audio (1 in, 0 out) 3 MacBook Pro Speakers, Core Audio (0 in, 2 out) Use default device: Bunpods - Find My Started! Please speak libc++abi: terminating zsh: abort python3
logs for python
(base) fawazahamedshaik@Fawazs-MacBook-Pro sherpa-onnx % python ./python-api-examples/speech-recognition-from-microphone-with-endpoint-detection.py \
--tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \
--encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \
--decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \
--joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx
0 Bunpods - Find My, Core Audio (1 in, 0 out) < 1 Bunpods - Find My, Core Audio (0 in, 2 out) 2 MacBook Pro Microphone, Core Audio (1 in, 0 out) 3 MacBook Pro Speakers, Core Audio (0 in, 2 out) Use default device: Bunpods - Find My Started! Please speak libc++abi: terminating zsh: abort python
Do you have a microphone on your computer?
I had earlier connected wireless earphones but disconnected them. They are working now. Thank you so much!
after installing ONNX on macOS arm chip
log:
(base) fawazahamedshaik@Fawazs-MacBook-Pro python-api-examples % python3 ./speech-recognition-from-microphone-with-endpoint-detection.py \ --tokens=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \ --encoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \ --decoder=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \ --joiner=./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx