csukuangfj commited on
Commit
b11b38b
·
1 Parent(s): 24c2ef7
examples.py CHANGED
@@ -72,6 +72,14 @@ examples = [
72
  "No",
73
  "./test_wavs/russian/russian-i-love-you.wav",
74
  ],
 
 
 
 
 
 
 
 
75
  [
76
  "Russian",
77
  "alphacep/vosk-model-ru",
@@ -437,4 +445,20 @@ examples = [
437
  "No",
438
  "./test_wavs/korean/3.wav",
439
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  ]
 
72
  "No",
73
  "./test_wavs/russian/russian-i-love-you.wav",
74
  ],
75
+ [
76
+ "Thai",
77
+ "yfyeung/icefall-asr-gigaspeech2-th-zipformer-2024-06-20",
78
+ "greedy_search",
79
+ 4,
80
+ "No",
81
+ "./test_wavs/thai/0.wav",
82
+ ],
83
  [
84
  "Russian",
85
  "alphacep/vosk-model-ru",
 
445
  "No",
446
  "./test_wavs/korean/3.wav",
447
  ],
448
+ [
449
+ "Thai",
450
+ "yfyeung/icefall-asr-gigaspeech2-th-zipformer-2024-06-20",
451
+ "greedy_search",
452
+ 4,
453
+ "No",
454
+ "./test_wavs/thai/1.wav",
455
+ ],
456
+ [
457
+ "Thai",
458
+ "yfyeung/icefall-asr-gigaspeech2-th-zipformer-2024-06-20",
459
+ "greedy_search",
460
+ 4,
461
+ "No",
462
+ "./test_wavs/thai/2.wav",
463
+ ],
464
  ]
model.py CHANGED
@@ -212,6 +212,10 @@ def get_pretrained_model(
212
  return korean_models[repo_id](
213
  repo_id, decoding_method=decoding_method, num_active_paths=num_active_paths
214
  )
 
 
 
 
215
  else:
216
  raise ValueError(f"Unsupported repo_id: {repo_id}")
217
 
@@ -293,6 +297,48 @@ def _get_aishell2_pretrained_model(
293
  return recognizer
294
 
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  @lru_cache(maxsize=10)
297
  def _get_zrjin_cantonese_pre_trained_model(
298
  repo_id: str, decoding_method: str, num_active_paths: int
@@ -1365,6 +1411,10 @@ korean_models = {
1365
  "k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16": _get_streaming_zipformer_pre_trained_model,
1366
  }
1367
 
 
 
 
 
1368
 
1369
  all_models = {
1370
  **chinese_models,
@@ -1379,6 +1429,7 @@ all_models = {
1379
  **french_models,
1380
  **russian_models,
1381
  **korean_models,
 
1382
  }
1383
 
1384
  language_to_models = {
@@ -1395,4 +1446,5 @@ language_to_models = {
1395
  "French": list(french_models.keys()),
1396
  "Russian": list(russian_models.keys()),
1397
  "Korean": list(korean_models.keys()),
 
1398
  }
 
212
  return korean_models[repo_id](
213
  repo_id, decoding_method=decoding_method, num_active_paths=num_active_paths
214
  )
215
+ elif repo_id in thai_models:
216
+ return thai_models[repo_id](
217
+ repo_id, decoding_method=decoding_method, num_active_paths=num_active_paths
218
+ )
219
  else:
220
  raise ValueError(f"Unsupported repo_id: {repo_id}")
221
 
 
297
  return recognizer
298
 
299
 
300
+ @lru_cache(maxsize=10)
301
+ def _get_yifan_thai_pretrained_model(
302
+ repo_id: str, decoding_method: str, num_active_paths: int
303
+ ) -> sherpa_onnx.OfflineRecognizer:
304
+ assert repo_id in (
305
+ "yfyeung/icefall-asr-gigaspeech2-th-zipformer-2024-06-20",
306
+ ), repo_id
307
+
308
+ encoder_model = _get_nn_model_filename(
309
+ repo_id=repo_id,
310
+ filename="encoder-epoch-12-avg-5.int8.onnx",
311
+ subfolder="exp",
312
+ )
313
+
314
+ decoder_model = _get_nn_model_filename(
315
+ repo_id=repo_id,
316
+ filename="decoder-epoch-12-avg-5.onnx",
317
+ subfolder="exp",
318
+ )
319
+
320
+ joiner_model = _get_nn_model_filename(
321
+ repo_id=repo_id,
322
+ filename="joiner-epoch-12-avg-5.int8.onnx",
323
+ subfolder="exp",
324
+ )
325
+
326
+ tokens = _get_token_filename(repo_id=repo_id, subfolder="data/lang_bpe_2000")
327
+
328
+ recognizer = sherpa_onnx.OfflineRecognizer.from_transducer(
329
+ tokens=tokens,
330
+ encoder=encoder_model,
331
+ decoder=decoder_model,
332
+ joiner=joiner_model,
333
+ num_threads=2,
334
+ sample_rate=16000,
335
+ feature_dim=80,
336
+ decoding_method=decoding_method,
337
+ )
338
+
339
+ return recognizer
340
+
341
+
342
  @lru_cache(maxsize=10)
343
  def _get_zrjin_cantonese_pre_trained_model(
344
  repo_id: str, decoding_method: str, num_active_paths: int
 
1411
  "k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16": _get_streaming_zipformer_pre_trained_model,
1412
  }
1413
 
1414
+ thai_models = {
1415
+ "yfyeung/icefall-asr-gigaspeech2-th-zipformer-2024-06-20": _get_yifan_thai_pretrained_model,
1416
+ }
1417
+
1418
 
1419
  all_models = {
1420
  **chinese_models,
 
1429
  **french_models,
1430
  **russian_models,
1431
  **korean_models,
1432
+ **thai_models,
1433
  }
1434
 
1435
  language_to_models = {
 
1446
  "French": list(french_models.keys()),
1447
  "Russian": list(russian_models.keys()),
1448
  "Korean": list(korean_models.keys()),
1449
+ "Thai": list(thai_models.keys()),
1450
  }
test_wavs/thai/0.wav ADDED
Binary file (144 kB). View file
 
test_wavs/thai/1.wav ADDED
Binary file (137 kB). View file
 
test_wavs/thai/2.wav ADDED
Binary file (316 kB). View file
 
test_wavs/thai/trans.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ 0 ก็เดี๋ยวเกมในนัดต่อไปต้องไปเจอกับทางอินโดนีเซียนะครับ
2
+ 1 ก็ไม่ได้เน้นเรื่องของผลการแข่งขันอยู่แล้วครับเหมือนที่คาร์ลอสเซซาร์นั้นได้บอกไว้นะครับ
3
+ 2 เกมในเกมที่แล้วเนี่ยตอนพักครึ่งหลังเนี่ยเหมือนคาร์ลอสจะบอกว่าจริงจริงจะไม่ส่งมูฮัมหมัดลงด้วยซ้ําแล้วนะครับแต่ว่าเหมือนกับท้ายเกมเนี่ยส่งไปด้วยความมั่นใจแล้วโอ้โหประตูที่สาม