Committed by
GitHub
Add ReazonSpeech Japanese pre-trained model (#1203)
正在显示
5 个修改的文件
包含
92 行增加
和
14 行删除
| @@ -16,6 +16,50 @@ echo "PATH: $PATH" | @@ -16,6 +16,50 @@ echo "PATH: $PATH" | ||
| 16 | which $EXE | 16 | which $EXE |
| 17 | 17 | ||
| 18 | log "------------------------------------------------------------------------" | 18 | log "------------------------------------------------------------------------" |
| 19 | +log "Run zipformer transducer models (Japanese from ReazonSpeech) " | ||
| 20 | +log "------------------------------------------------------------------------" | ||
| 21 | +url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01.tar.bz2 | ||
| 22 | + | ||
| 23 | +name=$(basename $url) | ||
| 24 | +curl -SL -O $url | ||
| 25 | +tar xvf $name | ||
| 26 | +rm $name | ||
| 27 | +repo=$(basename -s .tar.bz2 $name) | ||
| 28 | +ls -lh $repo | ||
| 29 | + | ||
| 30 | +cat $repo/test_wavs/*.txt | ||
| 31 | + | ||
| 32 | +log "test $repo" | ||
| 33 | +test_wavs=( | ||
| 34 | +1.wav | ||
| 35 | +2.wav | ||
| 36 | +3.wav | ||
| 37 | +4.wav | ||
| 38 | +5.wav | ||
| 39 | +) | ||
| 40 | + | ||
| 41 | +for w in ${test_wavs[@]}; do | ||
| 42 | + time $EXE \ | ||
| 43 | + --tokens=$repo/tokens.txt \ | ||
| 44 | + --encoder=$repo/encoder-epoch-99-avg-1.onnx \ | ||
| 45 | + --decoder=$repo/decoder-epoch-99-avg-1.onnx \ | ||
| 46 | + --joiner=$repo/joiner-epoch-99-avg-1.onnx \ | ||
| 47 | + --debug=1 \ | ||
| 48 | + $repo/test_wavs/$w | ||
| 49 | +done | ||
| 50 | + | ||
| 51 | +for w in ${test_wavs[@]}; do | ||
| 52 | + time $EXE \ | ||
| 53 | + --tokens=$repo/tokens.txt \ | ||
| 54 | + --encoder=$repo/encoder-epoch-99-avg-1.int8.onnx \ | ||
| 55 | + --decoder=$repo/decoder-epoch-99-avg-1.onnx \ | ||
| 56 | + --joiner=$repo/joiner-epoch-99-avg-1.int8.onnx \ | ||
| 57 | + --debug=1 \ | ||
| 58 | + $repo/test_wavs/$w | ||
| 59 | +done | ||
| 60 | +rm -rf $repo | ||
| 61 | + | ||
| 62 | +log "------------------------------------------------------------------------" | ||
| 19 | log "Run Nemo fast conformer hybrid transducer ctc models (transducer branch)" | 63 | log "Run Nemo fast conformer hybrid transducer ctc models (transducer branch)" |
| 20 | log "------------------------------------------------------------------------" | 64 | log "------------------------------------------------------------------------" |
| 21 | 65 |
| @@ -141,6 +141,17 @@ jobs: | @@ -141,6 +141,17 @@ jobs: | ||
| 141 | name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }} | 141 | name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }} |
| 142 | path: install/* | 142 | path: install/* |
| 143 | 143 | ||
| 144 | + - name: Test offline transducer | ||
| 145 | + shell: bash | ||
| 146 | + run: | | ||
| 147 | + du -h -d1 . | ||
| 148 | + export PATH=$PWD/build/bin:$PATH | ||
| 149 | + export EXE=sherpa-onnx-offline | ||
| 150 | + | ||
| 151 | + .github/scripts/test-offline-transducer.sh | ||
| 152 | + du -h -d1 . | ||
| 153 | + | ||
| 154 | + | ||
| 144 | - name: Test offline CTC | 155 | - name: Test offline CTC |
| 145 | shell: bash | 156 | shell: bash |
| 146 | run: | | 157 | run: | |
| @@ -191,16 +202,6 @@ jobs: | @@ -191,16 +202,6 @@ jobs: | ||
| 191 | .github/scripts/test-online-ctc.sh | 202 | .github/scripts/test-online-ctc.sh |
| 192 | du -h -d1 . | 203 | du -h -d1 . |
| 193 | 204 | ||
| 194 | - - name: Test offline transducer | ||
| 195 | - shell: bash | ||
| 196 | - run: | | ||
| 197 | - du -h -d1 . | ||
| 198 | - export PATH=$PWD/build/bin:$PATH | ||
| 199 | - export EXE=sherpa-onnx-offline | ||
| 200 | - | ||
| 201 | - .github/scripts/test-offline-transducer.sh | ||
| 202 | - du -h -d1 . | ||
| 203 | - | ||
| 204 | - name: Test C API | 205 | - name: Test C API |
| 205 | shell: bash | 206 | shell: bash |
| 206 | run: | | 207 | run: | |
| @@ -113,21 +113,22 @@ jobs: | @@ -113,21 +113,22 @@ jobs: | ||
| 113 | otool -L build/bin/sherpa-onnx | 113 | otool -L build/bin/sherpa-onnx |
| 114 | otool -l build/bin/sherpa-onnx | 114 | otool -l build/bin/sherpa-onnx |
| 115 | 115 | ||
| 116 | - - name: Test offline CTC | 116 | + - name: Test offline transducer |
| 117 | shell: bash | 117 | shell: bash |
| 118 | run: | | 118 | run: | |
| 119 | export PATH=$PWD/build/bin:$PATH | 119 | export PATH=$PWD/build/bin:$PATH |
| 120 | export EXE=sherpa-onnx-offline | 120 | export EXE=sherpa-onnx-offline |
| 121 | 121 | ||
| 122 | - .github/scripts/test-offline-ctc.sh | 122 | + .github/scripts/test-offline-transducer.sh |
| 123 | 123 | ||
| 124 | - - name: Test offline transducer | 124 | + |
| 125 | + - name: Test offline CTC | ||
| 125 | shell: bash | 126 | shell: bash |
| 126 | run: | | 127 | run: | |
| 127 | export PATH=$PWD/build/bin:$PATH | 128 | export PATH=$PWD/build/bin:$PATH |
| 128 | export EXE=sherpa-onnx-offline | 129 | export EXE=sherpa-onnx-offline |
| 129 | 130 | ||
| 130 | - .github/scripts/test-offline-transducer.sh | 131 | + .github/scripts/test-offline-ctc.sh |
| 131 | 132 | ||
| 132 | - name: Test online CTC | 133 | - name: Test online CTC |
| 133 | shell: bash | 134 | shell: bash |
| @@ -278,6 +278,25 @@ def get_models(): | @@ -278,6 +278,25 @@ def get_models(): | ||
| 278 | popd | 278 | popd |
| 279 | """, | 279 | """, |
| 280 | ), | 280 | ), |
| 281 | + Model( | ||
| 282 | + model_name="sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01", | ||
| 283 | + idx=16, | ||
| 284 | + lang="ja", | ||
| 285 | + short_name="zipformer_reazonspeech", | ||
| 286 | + cmd=""" | ||
| 287 | + pushd $model_name | ||
| 288 | + | ||
| 289 | + rm -rfv test_wavs | ||
| 290 | + | ||
| 291 | + rm -fv encoder-epoch-99-avg-1.onnx | ||
| 292 | + rm -fv decoder-epoch-99-avg-1.int8.onnx | ||
| 293 | + rm -fv joiner-epoch-99-avg-1.onnx | ||
| 294 | + | ||
| 295 | + ls -lh | ||
| 296 | + | ||
| 297 | + popd | ||
| 298 | + """, | ||
| 299 | + ), | ||
| 281 | ] | 300 | ] |
| 282 | return models | 301 | return models |
| 283 | 302 |
| @@ -338,6 +338,19 @@ fun getOfflineModelConfig(type: Int): OfflineModelConfig? { | @@ -338,6 +338,19 @@ fun getOfflineModelConfig(type: Int): OfflineModelConfig? { | ||
| 338 | tokens = "$modelDir/tokens.txt", | 338 | tokens = "$modelDir/tokens.txt", |
| 339 | ) | 339 | ) |
| 340 | } | 340 | } |
| 341 | + | ||
| 342 | + 16 -> { | ||
| 343 | + val modelDir = "sherpa-onnx-zipformer-ja-reazonspeech-2024-08-01" | ||
| 344 | + return OfflineModelConfig( | ||
| 345 | + transducer = OfflineTransducerModelConfig( | ||
| 346 | + encoder = "$modelDir/encoder-epoch-99-avg-1.int8.onnx", | ||
| 347 | + decoder = "$modelDir/decoder-epoch-99-avg-1.onnx", | ||
| 348 | + joiner = "$modelDir/joiner-epoch-99-avg-1.int8.onnx", | ||
| 349 | + ), | ||
| 350 | + tokens = "$modelDir/tokens.txt", | ||
| 351 | + modelType = "transducer", | ||
| 352 | + ) | ||
| 353 | + } | ||
| 341 | } | 354 | } |
| 342 | return null | 355 | return null |
| 343 | } | 356 | } |
-
请 注册 或 登录 后发表评论