Commit
·
5b99533
1
Parent(s):
bff01f3
add a new model
Browse files
model.py
CHANGED
|
@@ -1627,6 +1627,41 @@ def _get_streaming_zipformer_ctc_pre_trained_model(
|
|
| 1627 |
return recognizer
|
| 1628 |
|
| 1629 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1630 |
@lru_cache(maxsize=10)
|
| 1631 |
def _get_non_streaming_zipformer_ctc_pre_trained_model(
|
| 1632 |
repo_id: str,
|
|
@@ -2254,6 +2289,7 @@ chinese_cantonese_english_japanese_korean_models = {
|
|
| 2254 |
}
|
| 2255 |
|
| 2256 |
cantonese_models = {
|
|
|
|
| 2257 |
"zrjin/icefall-asr-mdcc-zipformer-2024-03-11": _get_zrjin_cantonese_pre_trained_model,
|
| 2258 |
}
|
| 2259 |
|
|
|
|
| 1627 |
return recognizer
|
| 1628 |
|
| 1629 |
|
| 1630 |
+
@lru_cache(maxsize=10)
|
| 1631 |
+
def _get_non_streaming_wenet_ctc_pre_trained_model(
|
| 1632 |
+
repo_id: str,
|
| 1633 |
+
decoding_method: str,
|
| 1634 |
+
num_active_paths: int,
|
| 1635 |
+
) -> sherpa_onnx.OfflineRecognizer:
|
| 1636 |
+
assert repo_id in [
|
| 1637 |
+
"csukuangfj/sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10"
|
| 1638 |
+
], repo_id
|
| 1639 |
+
|
| 1640 |
+
if "int8" in repo_id:
|
| 1641 |
+
model = _get_nn_model_filename(
|
| 1642 |
+
repo_id=repo_id,
|
| 1643 |
+
filename="model.int8.onnx",
|
| 1644 |
+
subfolder=".",
|
| 1645 |
+
)
|
| 1646 |
+
else:
|
| 1647 |
+
model = _get_nn_model_filename(
|
| 1648 |
+
repo_id=repo_id,
|
| 1649 |
+
filename="model.onnx",
|
| 1650 |
+
subfolder=".",
|
| 1651 |
+
)
|
| 1652 |
+
tokens = _get_token_filename(repo_id=repo_id, subfolder=".")
|
| 1653 |
+
|
| 1654 |
+
recognizer = sherpa_onnx.OfflineRecognizer.from_wenet_ctc(
|
| 1655 |
+
tokens=tokens,
|
| 1656 |
+
model=model,
|
| 1657 |
+
num_threads=2,
|
| 1658 |
+
sample_rate=16000,
|
| 1659 |
+
feature_dim=80,
|
| 1660 |
+
)
|
| 1661 |
+
|
| 1662 |
+
return recognizer
|
| 1663 |
+
|
| 1664 |
+
|
| 1665 |
@lru_cache(maxsize=10)
|
| 1666 |
def _get_non_streaming_zipformer_ctc_pre_trained_model(
|
| 1667 |
repo_id: str,
|
|
|
|
| 2289 |
}
|
| 2290 |
|
| 2291 |
cantonese_models = {
|
| 2292 |
+
"csukuangfj/sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10": _get_non_streaming_wenet_ctc_pre_trained_model,
|
| 2293 |
"zrjin/icefall-asr-mdcc-zipformer-2024-03-11": _get_zrjin_cantonese_pre_trained_model,
|
| 2294 |
}
|
| 2295 |
|