Spaces:
Runtime error
Runtime error
csukuangfj
commited on
Commit
·
f1df253
1
Parent(s):
7459972
minor fixes
Browse files
app.py
CHANGED
@@ -159,8 +159,14 @@ def process(
|
|
159 |
info = f"""
|
160 |
Wave duration : {duration: .3f} s <br/>
|
161 |
Processing time: {end - start: .3f} s <br/>
|
162 |
-
RTF: {end - start: .3f}/{duration: .3f} = {
|
163 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
logging.info(info)
|
165 |
logging.info(f"hyp:\n{hyp}")
|
166 |
|
@@ -171,12 +177,17 @@ title = "# Automatic Speech Recognition with Next-gen Kaldi"
|
|
171 |
description = """
|
172 |
This space shows how to do automatic speech recognition with Next-gen Kaldi.
|
173 |
|
|
|
|
|
174 |
See more information by visiting the following links:
|
175 |
|
176 |
- <https://github.com/k2-fsa/icefall>
|
177 |
- <https://github.com/k2-fsa/sherpa>
|
178 |
- <https://github.com/k2-fsa/k2>
|
179 |
- <https://github.com/lhotse-speech/lhotse>
|
|
|
|
|
|
|
180 |
"""
|
181 |
|
182 |
# css style is copied from
|
|
|
159 |
info = f"""
|
160 |
Wave duration : {duration: .3f} s <br/>
|
161 |
Processing time: {end - start: .3f} s <br/>
|
162 |
+
RTF: {end - start: .3f}/{duration: .3f} = {rtf:.3f} <br/>
|
163 |
"""
|
164 |
+
if rtf > 1:
|
165 |
+
info += (
|
166 |
+
f"<br/>We are loading the model for the first run. "
|
167 |
+
"Please run again to measure the real RTF.<br/>"
|
168 |
+
)
|
169 |
+
|
170 |
logging.info(info)
|
171 |
logging.info(f"hyp:\n{hyp}")
|
172 |
|
|
|
177 |
description = """
|
178 |
This space shows how to do automatic speech recognition with Next-gen Kaldi.
|
179 |
|
180 |
+
It is running on CPU within a docker container provided by Hugging Face.
|
181 |
+
|
182 |
See more information by visiting the following links:
|
183 |
|
184 |
- <https://github.com/k2-fsa/icefall>
|
185 |
- <https://github.com/k2-fsa/sherpa>
|
186 |
- <https://github.com/k2-fsa/k2>
|
187 |
- <https://github.com/lhotse-speech/lhotse>
|
188 |
+
|
189 |
+
If you want to deploy it locally, please see
|
190 |
+
<https://k2-fsa.github.io/sherpa/>
|
191 |
"""
|
192 |
|
193 |
# css style is copied from
|
model.py
CHANGED
@@ -81,7 +81,7 @@ def _get_aishell2_pretrained_model(repo_id: str) -> OfflineAsr:
|
|
81 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-A-2022-07-12", # noqa
|
82 |
# context-size 2
|
83 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-B-2022-07-12", # noqa
|
84 |
-
]
|
85 |
|
86 |
nn_model_filename = _get_nn_model_filename(
|
87 |
repo_id=repo_id,
|
@@ -102,12 +102,11 @@ def _get_aishell2_pretrained_model(repo_id: str) -> OfflineAsr:
|
|
102 |
def _get_gigaspeech_pre_trained_model(repo_id: str) -> OfflineAsr:
|
103 |
assert repo_id in [
|
104 |
"wgb14/icefall-asr-gigaspeech-pruned-transducer-stateless2",
|
105 |
-
]
|
106 |
|
107 |
nn_model_filename = _get_nn_model_filename(
|
108 |
-
|
109 |
-
|
110 |
-
filename="cpu_jit-epoch-29-avg-11-torch-1.10.0.pt",
|
111 |
)
|
112 |
bpe_model_filename = _get_bpe_model_filename(repo_id=repo_id)
|
113 |
|
@@ -124,7 +123,7 @@ def _get_gigaspeech_pre_trained_model(repo_id: str) -> OfflineAsr:
|
|
124 |
def _get_librispeech_pre_trained_model(repo_id: str) -> OfflineAsr:
|
125 |
assert repo_id in [
|
126 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13", # noqa
|
127 |
-
]
|
128 |
|
129 |
nn_model_filename = _get_nn_model_filename(
|
130 |
repo_id=repo_id,
|
@@ -145,7 +144,7 @@ def _get_librispeech_pre_trained_model(repo_id: str) -> OfflineAsr:
|
|
145 |
def _get_wenetspeech_pre_trained_model(repo_id: str):
|
146 |
assert repo_id in [
|
147 |
"luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2",
|
148 |
-
]
|
149 |
|
150 |
nn_model_filename = _get_nn_model_filename(
|
151 |
repo_id=repo_id,
|
@@ -166,7 +165,7 @@ def _get_wenetspeech_pre_trained_model(repo_id: str):
|
|
166 |
def _get_tal_csasr_pre_trained_model(repo_id: str):
|
167 |
assert repo_id in [
|
168 |
"luomingshuang/icefall_asr_tal-csasr_pruned_transducer_stateless5",
|
169 |
-
]
|
170 |
|
171 |
nn_model_filename = _get_nn_model_filename(
|
172 |
repo_id=repo_id,
|
@@ -187,7 +186,7 @@ def _get_tal_csasr_pre_trained_model(repo_id: str):
|
|
187 |
def _get_alimeeting_pre_trained_model(repo_id: str):
|
188 |
assert repo_id in [
|
189 |
"luomingshuang/icefall_asr_alimeeting_pruned_transducer_stateless2",
|
190 |
-
]
|
191 |
|
192 |
nn_model_filename = _get_nn_model_filename(
|
193 |
repo_id=repo_id,
|
|
|
81 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-A-2022-07-12", # noqa
|
82 |
# context-size 2
|
83 |
"yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-B-2022-07-12", # noqa
|
84 |
+
], repo_id
|
85 |
|
86 |
nn_model_filename = _get_nn_model_filename(
|
87 |
repo_id=repo_id,
|
|
|
102 |
def _get_gigaspeech_pre_trained_model(repo_id: str) -> OfflineAsr:
|
103 |
assert repo_id in [
|
104 |
"wgb14/icefall-asr-gigaspeech-pruned-transducer-stateless2",
|
105 |
+
], repo_id
|
106 |
|
107 |
nn_model_filename = _get_nn_model_filename(
|
108 |
+
repo_id=repo_id,
|
109 |
+
filename="cpu_jit-iter-3488000-avg-20.pt",
|
|
|
110 |
)
|
111 |
bpe_model_filename = _get_bpe_model_filename(repo_id=repo_id)
|
112 |
|
|
|
123 |
def _get_librispeech_pre_trained_model(repo_id: str) -> OfflineAsr:
|
124 |
assert repo_id in [
|
125 |
"csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13", # noqa
|
126 |
+
], repo_id
|
127 |
|
128 |
nn_model_filename = _get_nn_model_filename(
|
129 |
repo_id=repo_id,
|
|
|
144 |
def _get_wenetspeech_pre_trained_model(repo_id: str):
|
145 |
assert repo_id in [
|
146 |
"luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2",
|
147 |
+
], repo_id
|
148 |
|
149 |
nn_model_filename = _get_nn_model_filename(
|
150 |
repo_id=repo_id,
|
|
|
165 |
def _get_tal_csasr_pre_trained_model(repo_id: str):
|
166 |
assert repo_id in [
|
167 |
"luomingshuang/icefall_asr_tal-csasr_pruned_transducer_stateless5",
|
168 |
+
], repo_id
|
169 |
|
170 |
nn_model_filename = _get_nn_model_filename(
|
171 |
repo_id=repo_id,
|
|
|
186 |
def _get_alimeeting_pre_trained_model(repo_id: str):
|
187 |
assert repo_id in [
|
188 |
"luomingshuang/icefall_asr_alimeeting_pruned_transducer_stateless2",
|
189 |
+
], repo_id
|
190 |
|
191 |
nn_model_filename = _get_nn_model_filename(
|
192 |
repo_id=repo_id,
|