From cfb2fda87c29db780e595b75f2de1c7710ebadd2 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 30 一月 2023 17:50:36 +0800
Subject: [PATCH] fix bug, ys_pad_masked in sampler of paraformer

---
 funasr/utils/asr_utils.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/funasr/utils/asr_utils.py b/funasr/utils/asr_utils.py
index 4258f05..0bf903c 100644
--- a/funasr/utils/asr_utils.py
+++ b/funasr/utils/asr_utils.py
@@ -49,12 +49,20 @@
         r_audio_format = 'pcm'
         r_recog_type = 'wav'
 
-    if r_recog_type is None:
+    if audio_in is None:
+        # for raw_inputs
+        r_recog_type = 'wav'
+        r_audio_format = 'pcm'
+
+    if r_recog_type is None and audio_in is not None:
         # audio_in is wav, recog_type is wav_file
         if os.path.isfile(audio_in):
             if audio_in.endswith('.wav') or audio_in.endswith('.WAV'):
                 r_recog_type = 'wav'
                 r_audio_format = 'wav'
+            elif audio_in.endswith('.scp') or audio_in.endswith('.SCP'):
+                r_recog_type = 'wav'
+                r_audio_format = 'scp'
 
         # recog_type is datasets_file
         elif os.path.isdir(audio_in):

--
Gitblit v1.9.1