From 28ccfbfc51068a663a80764e14074df5edf2b5ba Mon Sep 17 00:00:00 2001
From: kongdeqiang <kongdeqiang960204@163.com>
Date: 星期五, 13 三月 2026 17:41:41 +0800
Subject: [PATCH] 提交
---
runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py b/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py
index bf325c8..6a06ed1 100644
--- a/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py
+++ b/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py
@@ -92,7 +92,7 @@
return self.lid_dict[lid]
else:
raise ValueError(
- f"The language {l} is not in {list(self.lid_dict.keys())}"
+ f"The language {lid} is not in {list(self.lid_dict.keys())}"
)
def _get_tnid(self, tnid):
@@ -183,8 +183,10 @@
# ctc_logits = torch.from_numpy(ctc_logits).float()
# support batch_size=1 only currently
x = ctc_logits[b, : encoder_out_lens[b].item(), :]
- yseq = x.argmax(dim=-1)
- yseq = np.unique(yseq)
+ yseq = np.argmax(x, axis=-1)
+ # Use np.diff and np.where instead of torch.unique_consecutive.
+ mask = np.concatenate(([True], np.diff(yseq) != 0))
+ yseq = yseq[mask]
mask = yseq != self.blank_id
token_int = yseq[mask].tolist()
--
Gitblit v1.9.1