From fcb2102a602b39777fce9a7c197dbb6442eeba55 Mon Sep 17 00:00:00 2001
From: zhong zhuang <zhuangz@lamda.nju.edu.cn>
Date: 星期六, 21 十二月 2024 17:14:35 +0800
Subject: [PATCH] Fix seaco onnx export bug (#2325)
---
runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py b/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py
index b3d8dcf..bf325c8 100644
--- a/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py
+++ b/runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py
@@ -3,8 +3,6 @@
# Copyright FunASR (https://github.com/FunAudioLLM/SenseVoice). All Rights Reserved.
# MIT License (https://opensource.org/licenses/MIT)
-
-import torch
import os.path
import librosa
import numpy as np
@@ -181,12 +179,12 @@
)
for b in range(feats.shape[0]):
# back to torch.Tensor
- if isinstance(ctc_logits, np.ndarray):
- ctc_logits = torch.from_numpy(ctc_logits).float()
+ # if isinstance(ctc_logits, np.ndarray):
+ # 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 = torch.unique_consecutive(yseq, dim=-1)
+ yseq = np.unique(yseq)
mask = yseq != self.blank_id
token_int = yseq[mask].tolist()
--
Gitblit v1.9.1