From 79b09f1d6779be8606ecfe59ab457a55cc192578 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 05 六月 2024 17:22:21 +0800
Subject: [PATCH] auto frontend
---
funasr/auto/auto_frontend.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/funasr/auto/auto_frontend.py b/funasr/auto/auto_frontend.py
index 3d6db8d..eb4201d 100644
--- a/funasr/auto/auto_frontend.py
+++ b/funasr/auto/auto_frontend.py
@@ -87,8 +87,16 @@
speech_lengths.sum().item() * self.frontend.frame_shift * self.frontend.lfr_n / 1000
)
- speech.to(device=device), speech_lengths.to(device=device)
- batch = {"input": speech, "input_len": speech_lengths, "key": key_batch}
+ if kwargs.get("return_pt", True):
+ speech, speech_lengths = speech.to(device=device), speech_lengths.to(device=device)
+ else:
+ speech, speech_lengths = speech.numpy(), speech_lengths.numpy()
+ batch = {
+ "input": speech,
+ "input_len": speech_lengths,
+ "key": key_batch,
+ "data_type": "fbank",
+ }
result_list.append(batch)
pbar.update(1)
--
Gitblit v1.9.1