From 1596f6f414f6f41da66506debb1dff19fffeb3ec Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 24 六月 2024 11:55:17 +0800
Subject: [PATCH] fixbug hotwords
---
funasr/auto/auto_frontend.py | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/funasr/auto/auto_frontend.py b/funasr/auto/auto_frontend.py
index 3d6db8d..501d1ab 100644
--- a/funasr/auto/auto_frontend.py
+++ b/funasr/auto/auto_frontend.py
@@ -60,7 +60,7 @@
result_list = []
num_samples = len(data_list)
- pbar = tqdm(colour="blue", total=num_samples + 1, dynamic_ncols=True)
+ # pbar = tqdm(colour="blue", total=num_samples + 1, dynamic_ncols=True)
time0 = time.perf_counter()
for beg_idx in range(0, num_samples, batch_size):
@@ -87,15 +87,23 @@
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)
- description = f"{meta_data}, "
- pbar.set_description(description)
+ # pbar.update(1)
+ # description = f"{meta_data}, "
+ # pbar.set_description(description)
time_end = time.perf_counter()
- pbar.set_description(f"time escaped total: {time_end - time0:0.3f}")
+ # pbar.set_description(f"time escaped total: {time_end - time0:0.3f}")
return result_list
--
Gitblit v1.9.1