Add non-streaming ONNX models for Russian ASR (#1358)
This commit is contained in:
40
.github/scripts/test-offline-transducer.sh
vendored
40
.github/scripts/test-offline-transducer.sh
vendored
@@ -15,6 +15,46 @@ echo "PATH: $PATH"
|
|||||||
|
|
||||||
which $EXE
|
which $EXE
|
||||||
|
|
||||||
|
log "------------------------------------------------------------------------"
|
||||||
|
log "Run zipformer transducer models (Russian) "
|
||||||
|
log "------------------------------------------------------------------------"
|
||||||
|
for type in small-zipformer zipformer; do
|
||||||
|
url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-$type-ru-2024-09-18.tar.bz2
|
||||||
|
name=$(basename $url)
|
||||||
|
curl -SL -O $url
|
||||||
|
tar xvf $name
|
||||||
|
rm $name
|
||||||
|
repo=$(basename -s .tar.bz2 $name)
|
||||||
|
ls -lh $repo
|
||||||
|
|
||||||
|
log "test $repo"
|
||||||
|
test_wavs=(
|
||||||
|
0.wav
|
||||||
|
1.wav
|
||||||
|
)
|
||||||
|
|
||||||
|
for w in ${test_wavs[@]}; do
|
||||||
|
time $EXE \
|
||||||
|
--tokens=$repo/tokens.txt \
|
||||||
|
--encoder=$repo/encoder.onnx \
|
||||||
|
--decoder=$repo/decoder.onnx \
|
||||||
|
--joiner=$repo/joiner.onnx \
|
||||||
|
--debug=1 \
|
||||||
|
$repo/test_wavs/$w
|
||||||
|
done
|
||||||
|
|
||||||
|
for w in ${test_wavs[@]}; do
|
||||||
|
time $EXE \
|
||||||
|
--tokens=$repo/tokens.txt \
|
||||||
|
--encoder=$repo/encoder.int8.onnx \
|
||||||
|
--decoder=$repo/decoder.onnx \
|
||||||
|
--joiner=$repo/joiner.int8.onnx \
|
||||||
|
--debug=1 \
|
||||||
|
$repo/test_wavs/$w
|
||||||
|
done
|
||||||
|
rm -rf $repo
|
||||||
|
done
|
||||||
|
|
||||||
log "------------------------------------------------------------------------"
|
log "------------------------------------------------------------------------"
|
||||||
log "Run zipformer transducer models (Japanese from ReazonSpeech) "
|
log "Run zipformer transducer models (Japanese from ReazonSpeech) "
|
||||||
log "------------------------------------------------------------------------"
|
log "------------------------------------------------------------------------"
|
||||||
|
|||||||
108
.github/workflows/export-russian-onnx-models.yaml
vendored
Normal file
108
.github/workflows/export-russian-onnx-models.yaml
vendored
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
name: export-russian-onnx-models
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: export-russian-onnx-models-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
export-russian-onnx-models:
|
||||||
|
if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj'
|
||||||
|
name: export Russian onnx models
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest]
|
||||||
|
python-version: ["3.8"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: vosk-model-ru (zipformer v1)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cat >README.md <<EOF
|
||||||
|
# Introduction
|
||||||
|
Models in this directory are from
|
||||||
|
https://huggingface.co/alphacep/vosk-model-ru/tree/main
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat README.md
|
||||||
|
|
||||||
|
d=sherpa-onnx-zipformer-ru-2024-09-18
|
||||||
|
mkdir $d
|
||||||
|
pushd $d
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/lang/bpe.model
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/lang/tokens.txt
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/am-onnx/encoder.int8.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/am-onnx/decoder.int8.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/am-onnx/joiner.int8.onnx
|
||||||
|
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/am-onnx/encoder.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/am-onnx/decoder.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-ru/resolve/main/am-onnx/joiner.onnx
|
||||||
|
|
||||||
|
mkdir test_wavs
|
||||||
|
cd test_wavs
|
||||||
|
curl -SL -O https://huggingface.co/spaces/k2-fsa/automatic-speech-recognition/resolve/main/test_wavs/russian/russian-i-love-you.wav
|
||||||
|
curl -SL -O https://huggingface.co/spaces/k2-fsa/automatic-speech-recognition/resolve/main/test_wavs/russian/test.wav
|
||||||
|
|
||||||
|
mv russian-i-love-you.wav 0.wav
|
||||||
|
mv test.wav 1.wav
|
||||||
|
popd
|
||||||
|
|
||||||
|
ls -lh $d
|
||||||
|
|
||||||
|
tar cjvf $d.tar.bz2 $d
|
||||||
|
rm -rf $d
|
||||||
|
|
||||||
|
- name: vosk-model-ru-small (zipformer v1)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cat >README.md <<EOF
|
||||||
|
# Introduction
|
||||||
|
Models in this directory are from
|
||||||
|
https://huggingface.co/alphacep/vosk-model-small-ru/tree/main
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat README.md
|
||||||
|
|
||||||
|
d=sherpa-onnx-small-zipformer-ru-2024-09-18
|
||||||
|
mkdir $d
|
||||||
|
pushd $d
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/lang/bpe.model
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/lang/tokens.txt
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/am/encoder.int8.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/am/decoder.int8.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/am/joiner.int8.onnx
|
||||||
|
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/am/encoder.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/am/decoder.onnx
|
||||||
|
curl -SL -O https://huggingface.co/alphacep/vosk-model-small-ru/resolve/main/am/joiner.onnx
|
||||||
|
|
||||||
|
mkdir test_wavs
|
||||||
|
cd test_wavs
|
||||||
|
curl -SL -O https://huggingface.co/spaces/k2-fsa/automatic-speech-recognition/resolve/main/test_wavs/russian/russian-i-love-you.wav
|
||||||
|
curl -SL -O https://huggingface.co/spaces/k2-fsa/automatic-speech-recognition/resolve/main/test_wavs/russian/test.wav
|
||||||
|
|
||||||
|
mv russian-i-love-you.wav 0.wav
|
||||||
|
mv test.wav 1.wav
|
||||||
|
popd
|
||||||
|
|
||||||
|
ls -lh $d
|
||||||
|
|
||||||
|
tar cjvf $d.tar.bz2 $d
|
||||||
|
rm -rf $d
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
file_glob: true
|
||||||
|
file: ./*.tar.bz2
|
||||||
|
overwrite: true
|
||||||
|
repo_name: k2-fsa/sherpa-onnx
|
||||||
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
||||||
|
tag: asr-models
|
||||||
20
.github/workflows/linux.yaml
vendored
20
.github/workflows/linux.yaml
vendored
@@ -143,6 +143,16 @@ jobs:
|
|||||||
name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
|
name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
|
||||||
path: install/*
|
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
|
- name: Test offline CTC
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -163,16 +173,6 @@ jobs:
|
|||||||
.github/scripts/test-online-punctuation.sh
|
.github/scripts/test-online-punctuation.sh
|
||||||
du -h -d1 .
|
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 online transducer
|
- name: Test online transducer
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
15
.github/workflows/macos.yaml
vendored
15
.github/workflows/macos.yaml
vendored
@@ -115,14 +115,6 @@ jobs:
|
|||||||
otool -L build/bin/sherpa-onnx
|
otool -L build/bin/sherpa-onnx
|
||||||
otool -l build/bin/sherpa-onnx
|
otool -l build/bin/sherpa-onnx
|
||||||
|
|
||||||
- name: Test online punctuation
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
export PATH=$PWD/build/bin:$PATH
|
|
||||||
export EXE=sherpa-onnx-online-punctuation
|
|
||||||
|
|
||||||
.github/scripts/test-online-punctuation.sh
|
|
||||||
|
|
||||||
- name: Test offline transducer
|
- name: Test offline transducer
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -131,6 +123,13 @@ jobs:
|
|||||||
|
|
||||||
.github/scripts/test-offline-transducer.sh
|
.github/scripts/test-offline-transducer.sh
|
||||||
|
|
||||||
|
- name: Test online punctuation
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export PATH=$PWD/build/bin:$PATH
|
||||||
|
export EXE=sherpa-onnx-online-punctuation
|
||||||
|
|
||||||
|
.github/scripts/test-online-punctuation.sh
|
||||||
|
|
||||||
- name: Test offline CTC
|
- name: Test offline CTC
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -293,6 +293,46 @@ def get_models():
|
|||||||
|
|
||||||
ls -lh
|
ls -lh
|
||||||
|
|
||||||
|
popd
|
||||||
|
""",
|
||||||
|
),
|
||||||
|
Model(
|
||||||
|
model_name="sherpa-onnx-zipformer-ru-2024-09-18",
|
||||||
|
idx=17,
|
||||||
|
lang="ru",
|
||||||
|
short_name="zipformer",
|
||||||
|
cmd="""
|
||||||
|
pushd $model_name
|
||||||
|
|
||||||
|
rm -rfv test_wavs
|
||||||
|
|
||||||
|
rm -fv encoder.onnx
|
||||||
|
rm -fv decoder.int8.onnx
|
||||||
|
rm -fv joiner.onnx
|
||||||
|
rm -fv bpe.model
|
||||||
|
|
||||||
|
ls -lh
|
||||||
|
|
||||||
|
popd
|
||||||
|
""",
|
||||||
|
),
|
||||||
|
Model(
|
||||||
|
model_name="sherpa-onnx-small-zipformer-ru-2024-09-18",
|
||||||
|
idx=18,
|
||||||
|
lang="ru",
|
||||||
|
short_name="small_zipformer",
|
||||||
|
cmd="""
|
||||||
|
pushd $model_name
|
||||||
|
|
||||||
|
rm -rfv test_wavs
|
||||||
|
|
||||||
|
rm -fv encoder.onnx
|
||||||
|
rm -fv decoder.int8.onnx
|
||||||
|
rm -fv joiner.onnx
|
||||||
|
rm -fv bpe.model
|
||||||
|
|
||||||
|
ls -lh
|
||||||
|
|
||||||
popd
|
popd
|
||||||
""",
|
""",
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -368,6 +368,32 @@ fun getOfflineModelConfig(type: Int): OfflineModelConfig? {
|
|||||||
modelType = "transducer",
|
modelType = "transducer",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17 -> {
|
||||||
|
val modelDir = "sherpa-onnx-zipformer-ru-2024-09-18"
|
||||||
|
return OfflineModelConfig(
|
||||||
|
transducer = OfflineTransducerModelConfig(
|
||||||
|
encoder = "$modelDir/encoder.int8.onnx",
|
||||||
|
decoder = "$modelDir/decoder.onnx",
|
||||||
|
joiner = "$modelDir/joiner.int8.onnx",
|
||||||
|
),
|
||||||
|
tokens = "$modelDir/tokens.txt",
|
||||||
|
modelType = "transducer",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
18 -> {
|
||||||
|
val modelDir = "sherpa-onnx-small-zipformer-ru-2024-09-18"
|
||||||
|
return OfflineModelConfig(
|
||||||
|
transducer = OfflineTransducerModelConfig(
|
||||||
|
encoder = "$modelDir/encoder.int8.onnx",
|
||||||
|
decoder = "$modelDir/decoder.onnx",
|
||||||
|
joiner = "$modelDir/joiner.int8.onnx",
|
||||||
|
),
|
||||||
|
tokens = "$modelDir/tokens.txt",
|
||||||
|
modelType = "transducer",
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user