From 93a02feda1848531a48a1794a8de12a962c84a8e Mon Sep 17 00:00:00 2001
From: Xingchen Song(宋星辰) <xingchensong1996@163.com>
Date: 星期五, 07 六月 2024 23:10:13 +0800
Subject: [PATCH] [fix] fix empty asr result (#1794)
---
funasr/auto/auto_model.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index e8ca008..9b4f6d9 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -359,6 +359,7 @@
results_sorted = []
if not len(sorted_data):
+ results_ret_list.append({"key": key, "text": "", "timestamp": []})
logging.info("decoding, utt: {}, empty speech".format(key))
continue
@@ -387,6 +388,7 @@
):
max_len_in_batch = max(max_len_in_batch, sample_length)
end_idx += 1
+ results_sorted.append({'key': 'bad_data', 'text': '', 'timestamp': []})
continue
speech_j, speech_lengths_j = slice_padding_audio_samples(
@@ -416,7 +418,7 @@
end_idx += 1
max_len_in_batch = sample_length
if len(results) < 1:
- continue
+ results.append({'key': 'bad_data', 'text': '', 'timestamp': []})
results_sorted.extend(results)
# end_asr_total = time.time()
--
Gitblit v1.9.1