From e04489ce4c0fd0095d0c79ef8f504f425e0435a8 Mon Sep 17 00:00:00 2001
From: Shi Xian <40013335+R1ckShi@users.noreply.github.com>
Date: 星期三, 13 三月 2024 16:34:42 +0800
Subject: [PATCH] contextual&seaco ONNX export (#1481)
---
funasr/frontends/default.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/funasr/frontends/default.py b/funasr/frontends/default.py
index 66d42f7..c4bdbd7 100644
--- a/funasr/frontends/default.py
+++ b/funasr/frontends/default.py
@@ -48,6 +48,7 @@
# Deepcopy (In general, dict shouldn't be used as default arg)
frontend_conf = copy.deepcopy(frontend_conf)
self.hop_length = hop_length
+ self.fs = fs
if apply_stft:
self.stft = Stft(
@@ -84,8 +85,12 @@
return self.n_mels
def forward(
- self, input: torch.Tensor, input_lengths: torch.Tensor
+ self, input: torch.Tensor, input_lengths: Union[torch.Tensor, list]
) -> Tuple[torch.Tensor, torch.Tensor]:
+ if isinstance(input_lengths, list):
+ input_lengths = torch.tensor(input_lengths)
+ if input.dtype == torch.float64:
+ input = input.float()
# 1. Domain-conversion: e.g. Stft: time -> time-freq
if self.stft is not None:
input_stft, feats_lens = self._compute_stft(input, input_lengths)
--
Gitblit v1.9.1