Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fix: resolve IndexError when using spk model and the audio contains only 1 segment (#1535)

Atomie CHENff83116369ba
diff --git a/funasr/models/campplus/utils.py b/funasr/models/campplus/utils.py
index 935c674f9..399be4b0a 100644
--- a/funasr/models/campplus/utils.py
+++ b/funasr/models/campplus/utils.py
@@ -177,6 +177,9 @@ def merge_seque(distribute_res):
return res
def smooth(res, mindur=1):
+ # if only one segment, return directly
+ if len(res) < 2:
+ return res
# short segments are assigned to nearest speakers.
for i in range(len(res)):
res[i][0] = round(res[i][0], 2)