Add HLG decoding for streaming CTC models (#731)

This commit is contained in:
Fangjun Kuang
2024-04-03 21:31:42 +08:00
committed by GitHub
parent f8832cb5f2
commit db67e00c77
28 changed files with 668 additions and 82 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -e
set -ex
log() {
# This function is from espnet
@@ -8,6 +8,23 @@ log() {
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
}
log "test streaming zipformer2 ctc HLG decoding"
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18.tar.bz2
tar xvf sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18.tar.bz2
rm sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18.tar.bz2
repo=sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18
python3 ./python-api-examples/online-zipformer-ctc-hlg-decode-file.py \
--debug 1 \
--tokens ./sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18/tokens.txt \
--graph ./sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18/HLG.fst \
--model ./sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18/ctc-epoch-30-avg-3-chunk-16-left-128.int8.onnx \
./sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18/test_wavs/0.wav
rm -rf sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18
mkdir -p /tmp/icefall-models
dir=/tmp/icefall-models