Spaces:
Build error
Build error
Commit
·
3e38706
1
Parent(s):
74a5c18
add new models
Browse files
model.py
CHANGED
|
@@ -925,6 +925,39 @@ def _get_gigaspeech_pre_trained_model_onnx(
|
|
| 925 |
return recognizer
|
| 926 |
|
| 927 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 928 |
@lru_cache(maxsize=10)
|
| 929 |
def _get_paraformer_zh_pre_trained_model(
|
| 930 |
repo_id: str,
|
|
@@ -1058,6 +1091,8 @@ chinese_models = {
|
|
| 1058 |
"luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2": _get_wenetspeech_pre_trained_model, # noqa
|
| 1059 |
"zrjin/sherpa-onnx-zipformer-multi-zh-hans-2023-9-2": _get_multi_zh_hans_pre_trained_model, # noqa
|
| 1060 |
"zrjin/icefall-asr-aishell-zipformer-large-2023-10-24": _get_aishell_pre_trained_model, # noqa
|
|
|
|
|
|
|
| 1061 |
"desh2608/icefall-asr-alimeeting-pruned-transducer-stateless7": _get_alimeeting_pre_trained_model,
|
| 1062 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-A-2022-07-12": _get_aishell2_pretrained_model, # noqa
|
| 1063 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-B-2022-07-12": _get_aishell2_pretrained_model, # noqa
|
|
@@ -1080,6 +1115,7 @@ english_models = {
|
|
| 1080 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless8-2022-11-14": _get_english_model, # noqa
|
| 1081 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless7-2022-11-11": _get_english_model, # noqa
|
| 1082 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13": _get_english_model, # noqa
|
|
|
|
| 1083 |
"Zengwei/icefall-asr-librispeech-zipformer-large-2023-05-16": _get_english_model, # noqa
|
| 1084 |
"Zengwei/icefall-asr-librispeech-zipformer-2023-05-15": _get_english_model, # noqa
|
| 1085 |
"Zengwei/icefall-asr-librispeech-zipformer-small-2023-05-16": _get_english_model, # noqa
|
|
|
|
| 925 |
return recognizer
|
| 926 |
|
| 927 |
|
| 928 |
+
@lru_cache(maxsize=10)
|
| 929 |
+
def _get_paraformer_en_pre_trained_model(
|
| 930 |
+
repo_id: str,
|
| 931 |
+
decoding_method: str,
|
| 932 |
+
num_active_paths: int,
|
| 933 |
+
) -> sherpa_onnx.OfflineRecognizer:
|
| 934 |
+
assert repo_id in [
|
| 935 |
+
"yujinqiu/sherpa-onnx-paraformer-en-2023-10-24",
|
| 936 |
+
], repo_id
|
| 937 |
+
|
| 938 |
+
nn_model = _get_nn_model_filename(
|
| 939 |
+
repo_id=repo_id,
|
| 940 |
+
filename="model.int8.onnx",
|
| 941 |
+
subfolder=".",
|
| 942 |
+
)
|
| 943 |
+
|
| 944 |
+
tokens = _get_token_filename(
|
| 945 |
+
repo_id=repo_id, filename="new_tokens.txt", subfolder="."
|
| 946 |
+
)
|
| 947 |
+
|
| 948 |
+
recognizer = sherpa_onnx.OfflineRecognizer.from_paraformer(
|
| 949 |
+
paraformer=nn_model,
|
| 950 |
+
tokens=tokens,
|
| 951 |
+
num_threads=2,
|
| 952 |
+
sample_rate=sample_rate,
|
| 953 |
+
feature_dim=80,
|
| 954 |
+
decoding_method="greedy_search",
|
| 955 |
+
debug=False,
|
| 956 |
+
)
|
| 957 |
+
|
| 958 |
+
return recognizer
|
| 959 |
+
|
| 960 |
+
|
| 961 |
@lru_cache(maxsize=10)
|
| 962 |
def _get_paraformer_zh_pre_trained_model(
|
| 963 |
repo_id: str,
|
|
|
|
| 1091 |
"luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2": _get_wenetspeech_pre_trained_model, # noqa
|
| 1092 |
"zrjin/sherpa-onnx-zipformer-multi-zh-hans-2023-9-2": _get_multi_zh_hans_pre_trained_model, # noqa
|
| 1093 |
"zrjin/icefall-asr-aishell-zipformer-large-2023-10-24": _get_aishell_pre_trained_model, # noqa
|
| 1094 |
+
"zrjin/icefall-asr-aishell-zipformer-small-2023-10-24": _get_aishell_pre_trained_model, # noqa
|
| 1095 |
+
"zrjin/icefall-asr-aishell-zipformer-2023-10-24": _get_aishell_pre_trained_model, # noqa
|
| 1096 |
"desh2608/icefall-asr-alimeeting-pruned-transducer-stateless7": _get_alimeeting_pre_trained_model,
|
| 1097 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-A-2022-07-12": _get_aishell2_pretrained_model, # noqa
|
| 1098 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-B-2022-07-12": _get_aishell2_pretrained_model, # noqa
|
|
|
|
| 1115 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless8-2022-11-14": _get_english_model, # noqa
|
| 1116 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless7-2022-11-11": _get_english_model, # noqa
|
| 1117 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13": _get_english_model, # noqa
|
| 1118 |
+
"yujinqiu/sherpa-onnx-paraformer-en-2023-10-24": _get_paraformer_en_pre_trained_model,
|
| 1119 |
"Zengwei/icefall-asr-librispeech-zipformer-large-2023-05-16": _get_english_model, # noqa
|
| 1120 |
"Zengwei/icefall-asr-librispeech-zipformer-2023-05-15": _get_english_model, # noqa
|
| 1121 |
"Zengwei/icefall-asr-librispeech-zipformer-small-2023-05-16": _get_english_model, # noqa
|