2022-09-02 20:29:07 +08:00
# Introduction
2022-10-14 12:13:51 +08:00
Documentation: < https: / / k2-fsa . github . io / sherpa / onnx / index . html >
2022-10-14 18:53:59 +08:00
Try it in colab:
[](https://colab.research.google.com/drive/1tmQbdlYeTl_klmtaGiUb7a7ZPz-AkBSH?usp=sharing)
2022-09-02 20:29:07 +08:00
See < https: / / github . com / k2-fsa / sherpa >
This repo uses [onnxruntime ](https://github.com/microsoft/onnxruntime ) and
does not depend on libtorch.
2022-09-23 17:20:40 +03:00
2022-10-12 11:49:38 +08:00
We provide exported models in onnx format and they can be downloaded using
the following links:
- English: < https: // huggingface . co / csukuangfj / icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13 >
2022-10-13 14:59:12 +08:00
- Chinese: < https: // huggingface . co / luomingshuang / icefall_asr_wenetspeech_pruned_transducer_stateless2 >
2022-10-12 11:49:38 +08:00
**NOTE**: We provide only non-streaming models at present.
2022-09-23 17:20:40 +03:00
2022-10-12 21:35:07 +08:00
**HINT**: The script for exporting the English model can be found at
< https: / / github . com / k2-fsa / icefall / blob / master / egs / librispeech / ASR / pruned_transducer_stateless3 / export . py >
2022-10-13 14:59:12 +08:00
**HINT**: The script for exporting the Chinese model can be found at
< https: / / github . com / k2-fsa / icefall / blob / master / egs / wenetspeech / ASR / pruned_transducer_stateless2 / export . py >
2022-10-13 17:30:30 +08:00
## Build for Linux/macOS
2022-10-12 11:49:38 +08:00
```bash
2022-09-23 17:20:40 +03:00
git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
mkdir build
cd build
2022-10-13 17:30:30 +08:00
cmake -DCMAKE_BUILD_TYPE=Release ..
2022-10-12 11:49:38 +08:00
make -j6
cd ..
```
2022-10-13 17:30:30 +08:00
## Build for Windows
2022-10-12 11:49:38 +08:00
2022-10-13 17:30:30 +08:00
```bash
git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release
cd ..
```
## Download the pretrained model (English)
2022-10-12 11:49:38 +08:00
```bash
2022-10-13 17:30:30 +08:00
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13
cd icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13
git lfs pull --include "exp/onnx/*.onnx"
cd ..
2022-10-12 11:49:38 +08:00
2022-10-12 21:35:07 +08:00
./build/bin/sherpa-onnx --help
2022-10-12 11:49:38 +08:00
./build/bin/sherpa-onnx \
2022-10-12 21:35:07 +08:00
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/data/lang_bpe_500/tokens.txt \
2022-10-12 11:49:38 +08:00
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/encoder.onnx \
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/decoder.onnx \
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/joiner.onnx \
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/joiner_encoder_proj.onnx \
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/joiner_decoder_proj.onnx \
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1089-134686-0001.wav
2022-09-23 17:20:40 +03:00
```
2022-10-13 14:59:12 +08:00
## Download the pretrained model (Chinese)
```bash
2022-10-13 17:30:30 +08:00
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2
cd icefall_asr_wenetspeech_pruned_transducer_stateless2
git lfs pull --include "exp/*.onnx"
cd ..
2022-10-13 14:59:12 +08:00
./build/bin/sherpa-onnx --help
./build/bin/sherpa-onnx \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/data/lang_char/tokens.txt \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/exp/encoder-epoch-10-avg-2.onnx \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/exp/decoder-epoch-10-avg-2.onnx \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/exp/joiner-epoch-10-avg-2.onnx \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/exp/joiner_encoder_proj-epoch-10-avg-2.onnx \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/exp/joiner_decoder_proj-epoch-10-avg-2.onnx \
./icefall_asr_wenetspeech_pruned_transducer_stateless2/test_wavs/DEV_T0000000000.wav
```