From fa07bbc1764e721c6659e178d8ca1661c5e361a2 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 15 Jul 2024 19:44:36 +0800 Subject: [PATCH] Add APK for small paraformer (#1133) --- scripts/apk/generate-vad-asr-apk-script.py | 23 +++++++++++++++++++++ sherpa-onnx/kotlin-api/OfflineRecognizer.kt | 11 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/scripts/apk/generate-vad-asr-apk-script.py b/scripts/apk/generate-vad-asr-apk-script.py index 26726bc9f..8abe2f8ed 100755 --- a/scripts/apk/generate-vad-asr-apk-script.py +++ b/scripts/apk/generate-vad-asr-apk-script.py @@ -89,6 +89,29 @@ def get_models(): popd """, ), + Model( + model_name="sherpa-onnx-paraformer-zh-small-2024-03-09", + idx=14, + lang="zh", + short_name="small_paraformer", + rule_fsts="itn_zh_number.fst", + cmd=""" + if [ ! -f itn_zh_number.fst ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst + fi + pushd $model_name + + rm -fv README.md + rm -fv *.py + rm -fv *.yaml + rm -fv *.mvn + rm -rfv test_wavs + + ls -lh + + popd + """, + ), Model( model_name="icefall-asr-zipformer-wenetspeech-20230615", idx=4, diff --git a/sherpa-onnx/kotlin-api/OfflineRecognizer.kt b/sherpa-onnx/kotlin-api/OfflineRecognizer.kt index b8a53f05d..c5cf069ba 100644 --- a/sherpa-onnx/kotlin-api/OfflineRecognizer.kt +++ b/sherpa-onnx/kotlin-api/OfflineRecognizer.kt @@ -310,6 +310,17 @@ fun getOfflineModelConfig(type: Int): OfflineModelConfig? { modelType = "transducer", ) } + + 14 -> { + val modelDir = "sherpa-onnx-paraformer-zh-small-2024-03-09" + return OfflineModelConfig( + paraformer = OfflineParaformerModelConfig( + model = "$modelDir/model.int8.onnx", + ), + tokens = "$modelDir/tokens.txt", + modelType = "paraformer", + ) + } } return null }