Commit
·
8dd5d09
1
Parent(s):
5511596
add fire red asr
Browse files- app.py +4 -1
- model.py +35 -0
- requirements.txt +2 -2
app.py
CHANGED
@@ -207,7 +207,10 @@ def process(
|
|
207 |
Processing time: {end - start: .3f} s <br/>
|
208 |
RTF: {end - start: .3f}/{duration: .3f} = {rtf:.3f} <br/>
|
209 |
"""
|
210 |
-
if
|
|
|
|
|
|
|
211 |
info += (
|
212 |
"<br/>We are loading the model for the first run. "
|
213 |
"Please run again to measure the real RTF.<br/>"
|
|
|
207 |
Processing time: {end - start: .3f} s <br/>
|
208 |
RTF: {end - start: .3f}/{duration: .3f} = {rtf:.3f} <br/>
|
209 |
"""
|
210 |
+
if (
|
211 |
+
rtf > 1
|
212 |
+
and repo_id != "csukuangfj/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16"
|
213 |
+
):
|
214 |
info += (
|
215 |
"<br/>We are loading the model for the first run. "
|
216 |
"Please run again to measure the real RTF.<br/>"
|
model.py
CHANGED
@@ -760,6 +760,40 @@ def _get_wenetspeech_pre_trained_model(
|
|
760 |
return recognizer
|
761 |
|
762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
@lru_cache(maxsize=10)
|
764 |
def _get_chinese_english_mixed_model_onnx(
|
765 |
repo_id: str,
|
@@ -1749,6 +1783,7 @@ english_models = {
|
|
1749 |
}
|
1750 |
|
1751 |
chinese_english_mixed_models = {
|
|
|
1752 |
"csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20": _get_streaming_zipformer_pre_trained_model,
|
1753 |
"zrjin/icefall-asr-zipformer-multi-zh-en-2023-11-22": _get_chinese_english_mixed_model_onnx,
|
1754 |
"csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28": _get_paraformer_pre_trained_model,
|
|
|
760 |
return recognizer
|
761 |
|
762 |
|
763 |
+
@lru_cache(maxsize=1)
|
764 |
+
def _get_fire_red_asr_models(repo_id: str, decoding_method: str, num_active_paths: int):
|
765 |
+
assert repo_id in (
|
766 |
+
"csukuangfj/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16",
|
767 |
+
), repo_id
|
768 |
+
|
769 |
+
encoder = _get_nn_model_filename(
|
770 |
+
repo_id=repo_id,
|
771 |
+
filename="encoder.int8.onnx",
|
772 |
+
subfolder=".",
|
773 |
+
)
|
774 |
+
|
775 |
+
decoder = _get_nn_model_filename(
|
776 |
+
repo_id=repo_id,
|
777 |
+
filename="decoder.int8.onnx",
|
778 |
+
subfolder=".",
|
779 |
+
)
|
780 |
+
|
781 |
+
tokens = _get_nn_model_filename(
|
782 |
+
repo_id=repo_id,
|
783 |
+
filename="tokens.txt",
|
784 |
+
subfolder=".",
|
785 |
+
)
|
786 |
+
|
787 |
+
return (
|
788 |
+
sherpa_onnx.OfflineRecognizer.from_fire_red_asr(
|
789 |
+
encoder=encoder,
|
790 |
+
decoder=decoder,
|
791 |
+
tokens=tokens,
|
792 |
+
num_threads=2,
|
793 |
+
),
|
794 |
+
)
|
795 |
+
|
796 |
+
|
797 |
@lru_cache(maxsize=10)
|
798 |
def _get_chinese_english_mixed_model_onnx(
|
799 |
repo_id: str,
|
|
|
1783 |
}
|
1784 |
|
1785 |
chinese_english_mixed_models = {
|
1786 |
+
"csukuangfj/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16": _get_fire_red_asr_models,
|
1787 |
"csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20": _get_streaming_zipformer_pre_trained_model,
|
1788 |
"zrjin/icefall-asr-zipformer-multi-zh-en-2023-11-22": _get_chinese_english_mixed_model_onnx,
|
1789 |
"csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28": _get_paraformer_pre_trained_model,
|
requirements.txt
CHANGED
@@ -10,6 +10,6 @@ numpy
|
|
10 |
|
11 |
huggingface_hub
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
|
|
10 |
|
11 |
huggingface_hub
|
12 |
|
13 |
+
https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/cpu/1.10.44/sherpa_onnx-1.10.44-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
14 |
|
15 |
+
3sherpa-onnx>=1.10.36
|