Skip to content

Commit

Permalink
Add ReazonSpeech Japanese pre-trained model (#1203)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Aug 2, 2024
1 parent 53484fc commit 35c1b4a
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 14 deletions.
44 changes: 44 additions & 0 deletions .github/scripts/test-offline-transducer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,50 @@ echo "PATH: $PATH"

which $EXE

log "------------------------------------------------------------------------"
log "Run zipformer transducer models (Japanese from ReazonSpeech) "
log "------------------------------------------------------------------------"
url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01.tar.bz2

name=$(basename $url)
curl -SL -O $url
tar xvf $name
rm $name
repo=$(basename -s .tar.bz2 $name)
ls -lh $repo

cat $repo/test_wavs/*.txt

log "test $repo"
test_wavs=(
1.wav
2.wav
3.wav
4.wav
5.wav
)

for w in ${test_wavs[@]}; do
time $EXE \
--tokens=$repo/tokens.txt \
--encoder=$repo/encoder-epoch-99-avg-1.onnx \
--decoder=$repo/decoder-epoch-99-avg-1.onnx \
--joiner=$repo/joiner-epoch-99-avg-1.onnx \
--debug=1 \
$repo/test_wavs/$w
done

for w in ${test_wavs[@]}; do
time $EXE \
--tokens=$repo/tokens.txt \
--encoder=$repo/encoder-epoch-99-avg-1.int8.onnx \
--decoder=$repo/decoder-epoch-99-avg-1.onnx \
--joiner=$repo/joiner-epoch-99-avg-1.int8.onnx \
--debug=1 \
$repo/test_wavs/$w
done
rm -rf $repo

log "------------------------------------------------------------------------"
log "Run Nemo fast conformer hybrid transducer ctc models (transducer branch)"
log "------------------------------------------------------------------------"
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ jobs:
name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
path: install/*

- name: Test offline transducer
shell: bash
run: |
du -h -d1 .
export PATH=$PWD/build/bin:$PATH
export EXE=sherpa-onnx-offline
.github/scripts/test-offline-transducer.sh
du -h -d1 .
- name: Test offline CTC
shell: bash
run: |
Expand Down Expand Up @@ -191,16 +202,6 @@ jobs:
.github/scripts/test-online-ctc.sh
du -h -d1 .
- name: Test offline transducer
shell: bash
run: |
du -h -d1 .
export PATH=$PWD/build/bin:$PATH
export EXE=sherpa-onnx-offline
.github/scripts/test-offline-transducer.sh
du -h -d1 .
- name: Test C API
shell: bash
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,22 @@ jobs:
otool -L build/bin/sherpa-onnx
otool -l build/bin/sherpa-onnx
- name: Test offline CTC
- name: Test offline transducer
shell: bash
run: |
export PATH=$PWD/build/bin:$PATH
export EXE=sherpa-onnx-offline
.github/scripts/test-offline-ctc.sh
.github/scripts/test-offline-transducer.sh
- name: Test offline transducer
- name: Test offline CTC
shell: bash
run: |
export PATH=$PWD/build/bin:$PATH
export EXE=sherpa-onnx-offline
.github/scripts/test-offline-transducer.sh
.github/scripts/test-offline-ctc.sh
- name: Test online CTC
shell: bash
Expand Down
19 changes: 19 additions & 0 deletions scripts/apk/generate-vad-asr-apk-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,25 @@ def get_models():
ls -lh
popd
""",
),
Model(
model_name="sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01",
idx=16,
lang="ja",
short_name="zipformer_reazonspeech",
cmd="""
pushd $model_name
rm -rfv test_wavs
rm -fv encoder-epoch-99-avg-1.onnx
rm -fv decoder-epoch-99-avg-1.int8.onnx
rm -fv joiner-epoch-99-avg-1.onnx
ls -lh
popd
""",
),
Expand Down
13 changes: 13 additions & 0 deletions sherpa-onnx/kotlin-api/OfflineRecognizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ fun getOfflineModelConfig(type: Int): OfflineModelConfig? {
tokens = "$modelDir/tokens.txt",
)
}

16 -> {
val modelDir = "sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01"
return OfflineModelConfig(
transducer = OfflineTransducerModelConfig(
encoder = "$modelDir/encoder-epoch-99-avg-1.int8.onnx",
decoder = "$modelDir/decoder-epoch-99-avg-1.onnx",
joiner = "$modelDir/joiner-epoch-99-avg-1.int8.onnx",
),
tokens = "$modelDir/tokens.txt",
modelType = "transducer",
)
}
}
return null
}

0 comments on commit 35c1b4a

Please sign in to comment.