compute_wer.sh 942 B

123456789101112131415161718192021222324252627282930313233
  1. wav_dir=$1
  2. wav_files=$(ls $wav_dir/*.wav)
  3. # if wav_files is empty, then exit
  4. if [ -z "$wav_files" ]; then
  5. exit 1
  6. fi
  7. split_name=$2
  8. model_path=models/sherpa-onnx-paraformer-zh-2023-09-14
  9. if [ ! -d $model_path ]; then
  10. pip install sherpa-onnx
  11. wget -nc https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
  12. mkdir models
  13. tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 -C models
  14. fi
  15. python3 scripts/offline-decode-files.py \
  16. --tokens=$model_path/tokens.txt \
  17. --paraformer=$model_path/model.int8.onnx \
  18. --num-threads=2 \
  19. --decoding-method=greedy_search \
  20. --debug=false \
  21. --sample-rate=24000 \
  22. --log-dir $wav_dir \
  23. --feature-dim=80 \
  24. --split-name $split_name \
  25. --name sherpa_onnx \
  26. $wav_files
  27. # python3 scripts/paraformer-pytriton-client.py \
  28. # --log-dir $wav_dir \
  29. # --split-name $split_name \
  30. # $wav_files