From f79d31d86010a95ad45efe6cac5e5d0f95e4f35a Mon Sep 17 00:00:00 2001
From: shixian.shi <shixian.shi@alibaba-inc.com>
Date: 星期三, 10 一月 2024 11:21:03 +0800
Subject: [PATCH] update funasr-onnx

---
 runtime/python/onnxruntime/funasr_onnx/utils/utils.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/runtime/python/onnxruntime/funasr_onnx/utils/utils.py b/runtime/python/onnxruntime/funasr_onnx/utils/utils.py
index cf74200..1e7f880 100644
--- a/runtime/python/onnxruntime/funasr_onnx/utils/utils.py
+++ b/runtime/python/onnxruntime/funasr_onnx/utils/utils.py
@@ -7,7 +7,6 @@
 from typing import Any, Dict, Iterable, List, NamedTuple, Set, Tuple, Union
 
 import re
-import torch
 import numpy as np
 import yaml
 try:
@@ -27,14 +26,15 @@
     n_batch = len(xs)
     if max_len is None:
         max_len = max(x.size(0) for x in xs)
-    pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)
-
+    # pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)
+    # numpy format
+    pad = np.zeros((n_batch, max_len)).astype(np.int32)
     for i in range(n_batch):
-        pad[i, : xs[i].size(0)] = xs[i]
+        pad[i, : xs[i].shape[0]] = xs[i]
 
     return pad
 
-
+'''
 def make_pad_mask(lengths, xs=None, length_dim=-1, maxlen=None):
     if length_dim == 0:
         raise ValueError("length_dim cannot be 0: {}".format(length_dim))
@@ -67,7 +67,7 @@
         )
         mask = mask[ind].expand_as(xs).to(xs.device)
     return mask
-
+'''
 
 class TokenIDConverter():
     def __init__(self, token_list: Union[List, str],

--
Gitblit v1.9.1