Add HLG decoding for streaming CTC models (#731)
This commit is contained in:
22
.github/scripts/test-online-ctc.sh
vendored
22
.github/scripts/test-online-ctc.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
log() {
|
||||
# This function is from espnet
|
||||
@@ -13,6 +13,26 @@ echo "PATH: $PATH"
|
||||
|
||||
which $EXE
|
||||
|
||||
log "------------------------------------------------------------"
|
||||
log "Run streaming Zipformer2 CTC HLG decoding "
|
||||
log "------------------------------------------------------------"
|
||||
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=$PWD/sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18
|
||||
ls -lh $repo
|
||||
echo "pwd: $PWD"
|
||||
|
||||
$EXE \
|
||||
--zipformer2-ctc-model=$repo/ctc-epoch-30-avg-3-chunk-16-left-128.int8.onnx \
|
||||
--ctc-graph=$repo/HLG.fst \
|
||||
--tokens=$repo/tokens.txt \
|
||||
$repo/test_wavs/0.wav \
|
||||
$repo/test_wavs/1.wav \
|
||||
$repo/test_wavs/8k.wav
|
||||
|
||||
rm -rf sherpa-onnx-streaming-zipformer-ctc-small-2024-03-18
|
||||
|
||||
log "------------------------------------------------------------"
|
||||
log "Run streaming Zipformer2 CTC "
|
||||
log "------------------------------------------------------------"
|
||||
|
||||
19
.github/scripts/test-python.sh
vendored
19
.github/scripts/test-python.sh
vendored
@@ -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
|
||||
|
||||
|
||||
15
.github/workflows/linux.yaml
vendored
15
.github/workflows/linux.yaml
vendored
@@ -124,6 +124,14 @@ jobs:
|
||||
name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
|
||||
path: build/bin/*
|
||||
|
||||
- name: Test online CTC
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=$PWD/build/bin:$PATH
|
||||
export EXE=sherpa-onnx
|
||||
|
||||
.github/scripts/test-online-ctc.sh
|
||||
|
||||
- name: Test C API
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -149,13 +157,6 @@ jobs:
|
||||
|
||||
.github/scripts/test-kws.sh
|
||||
|
||||
- name: Test online CTC
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=$PWD/build/bin:$PATH
|
||||
export EXE=sherpa-onnx
|
||||
|
||||
.github/scripts/test-online-ctc.sh
|
||||
|
||||
- name: Test offline Whisper
|
||||
if: matrix.build_type != 'Debug'
|
||||
|
||||
Reference in New Issue
Block a user