Update model.py
Browse files
model.py
CHANGED
@@ -1378,25 +1378,7 @@ def _get_sherpa_onnx_nemo_transducer_models(
|
|
1378 |
|
1379 |
return recognizer
|
1380 |
|
1381 |
-
|
1382 |
-
def _get_nemo_ctc_models(repo_id: str, decoding_method: str, num_active_paths: int):
|
1383 |
-
nn_model = _get_nn_model_filename(
|
1384 |
-
repo_id=repo_id,
|
1385 |
-
filename="model.int8.onnx",
|
1386 |
-
subfolder=".",
|
1387 |
-
)
|
1388 |
-
tokens = _get_token_filename(
|
1389 |
-
repo_id=repo_id,
|
1390 |
-
filename="tokens.txt",
|
1391 |
-
subfolder=".",
|
1392 |
-
)
|
1393 |
-
recognizer = sherpa_onnx.OfflineRecognizer.from_nemo_ctc(
|
1394 |
-
tokens=tokens,
|
1395 |
-
model=nn_model,
|
1396 |
-
num_threads=2,
|
1397 |
-
language="es", # Force Spanish
|
1398 |
-
)
|
1399 |
-
return recognizer
|
1400 |
|
1401 |
@lru_cache(maxsize=10)
|
1402 |
def _get_sherpa_onnx_nemo_ctc_models(
|
@@ -1410,29 +1392,27 @@ def _get_sherpa_onnx_nemo_ctc_models(
|
|
1410 |
"csukuangfj/sherpa-onnx-nemo-stt_pt_fastconformer_hybrid_large_pc-int8",
|
1411 |
"csukuangfj/sherpa-onnx-nemo-stt_de_fastconformer_hybrid_large_pc",
|
1412 |
"csukuangfj/sherpa-onnx-nemo-stt_de_fastconformer_hybrid_large_pc-int8",
|
|
|
1413 |
], repo_id
|
1414 |
|
1415 |
-
if "int8" in repo_id
|
1416 |
-
model = _get_nn_model_filename(
|
1417 |
-
repo_id=repo_id,
|
1418 |
-
filename="model.int8.onnx",
|
1419 |
-
subfolder=".",
|
1420 |
-
)
|
1421 |
-
else:
|
1422 |
-
model = _get_nn_model_filename(
|
1423 |
-
repo_id=repo_id,
|
1424 |
-
filename="model.onnx",
|
1425 |
-
subfolder=".",
|
1426 |
-
)
|
1427 |
|
1428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1429 |
|
1430 |
recognizer = sherpa_onnx.OfflineRecognizer.from_nemo_ctc(
|
1431 |
tokens=tokens,
|
1432 |
model=model,
|
1433 |
num_threads=2,
|
1434 |
-
sample_rate=16000,
|
1435 |
-
feature_dim=80,
|
1436 |
)
|
1437 |
|
1438 |
return recognizer
|
@@ -2089,8 +2069,7 @@ multi_lingual_models = {
|
|
2089 |
"csukuangfj/sherpa-onnx-dolphin-small-ctc-multi-lang-int8-2025-04-02": _get_dolphin_ctc_models,
|
2090 |
"csukuangfj/sherpa-onnx-dolphin-base-ctc-multi-lang-2025-04-02": _get_dolphin_ctc_models,
|
2091 |
"csukuangfj/sherpa-onnx-dolphin-small-ctc-multi-lang-2025-04-02": _get_dolphin_ctc_models,
|
2092 |
-
"csukuangfj/sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8":
|
2093 |
-
"csukuangfj/sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8": _get_nemo_ctc_models,
|
2094 |
}
|
2095 |
|
2096 |
chinese_english_mixed_models = {
|
|
|
1378 |
|
1379 |
return recognizer
|
1380 |
|
1381 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1382 |
|
1383 |
@lru_cache(maxsize=10)
|
1384 |
def _get_sherpa_onnx_nemo_ctc_models(
|
|
|
1392 |
"csukuangfj/sherpa-onnx-nemo-stt_pt_fastconformer_hybrid_large_pc-int8",
|
1393 |
"csukuangfj/sherpa-onnx-nemo-stt_de_fastconformer_hybrid_large_pc",
|
1394 |
"csukuangfj/sherpa-onnx-nemo-stt_de_fastconformer_hybrid_large_pc-int8",
|
1395 |
+
"csukuangfj/sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8",
|
1396 |
], repo_id
|
1397 |
|
1398 |
+
filename = "model.int8.onnx" if "int8" in repo_id else "model.onnx"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1399 |
|
1400 |
+
model = _get_nn_model_filename(
|
1401 |
+
repo_id=repo_id,
|
1402 |
+
filename=filename,
|
1403 |
+
subfolder=".",
|
1404 |
+
)
|
1405 |
+
|
1406 |
+
tokens = _get_token_filename(
|
1407 |
+
repo_id=repo_id,
|
1408 |
+
filename="tokens.txt",
|
1409 |
+
subfolder=".",
|
1410 |
+
)
|
1411 |
|
1412 |
recognizer = sherpa_onnx.OfflineRecognizer.from_nemo_ctc(
|
1413 |
tokens=tokens,
|
1414 |
model=model,
|
1415 |
num_threads=2,
|
|
|
|
|
1416 |
)
|
1417 |
|
1418 |
return recognizer
|
|
|
2069 |
"csukuangfj/sherpa-onnx-dolphin-small-ctc-multi-lang-int8-2025-04-02": _get_dolphin_ctc_models,
|
2070 |
"csukuangfj/sherpa-onnx-dolphin-base-ctc-multi-lang-2025-04-02": _get_dolphin_ctc_models,
|
2071 |
"csukuangfj/sherpa-onnx-dolphin-small-ctc-multi-lang-2025-04-02": _get_dolphin_ctc_models,
|
2072 |
+
"csukuangfj/sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8": _get_sherpa_onnx_nemo_ctc_models,
|
|
|
2073 |
}
|
2074 |
|
2075 |
chinese_english_mixed_models = {
|