Skip to content

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

fix cif_predictor.py bug in mac GPU (#2727)

ylyingaefcf86b2c62
diff --git a/funasr/models/bicif_paraformer/cif_predictor.py b/funasr/models/bicif_paraformer/cif_predictor.py
index ca98cdc2b..77d4e9659 100644
--- a/funasr/models/bicif_paraformer/cif_predictor.py
+++ b/funasr/models/bicif_paraformer/cif_predictor.py
@@ -62,7 +62,7 @@ def cif(hidden, alphas, threshold):
max_label_len = len_labels.max()
for b in range(batch_size):
fire = fires[b, :]
- l = torch.index_select(frames[b, :, :], 0, torch.nonzero(fire >= threshold).squeeze())
+ l = torch.index_select(frames[b, :, :], 0, torch.nonzero(fire >= threshold).squeeze(-1))
pad_l = torch.zeros([max_label_len - l.size(0), hidden_size], device=hidden.device)
list_ls.append(torch.cat([l, pad_l], 0))
return torch.stack(list_ls, 0), fires
@@ -541,3 +541,4 @@ def cif_wo_hidden_export(alphas, threshold: float):
fires = torch.stack(list_fires, 1)
return fires
+