From c3c78fc5e790d48b3a2f9da79199320c06108d38 Mon Sep 17 00:00:00 2001
From: shixian.shi <shixian.shi@alibaba-inc.com>
Date: 星期五, 12 一月 2024 18:23:56 +0800
Subject: [PATCH] bug fix
---
funasr/models/fsmn_vad/model.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/funasr/models/fsmn_vad/model.py b/funasr/models/fsmn_vad/model.py
index 75c6f4a..b31e061 100644
--- a/funasr/models/fsmn_vad/model.py
+++ b/funasr/models/fsmn_vad/model.py
@@ -12,6 +12,7 @@
from funasr.utils.load_utils import load_audio_text_image_video,extract_fbank
from funasr.utils.datadir_writer import DatadirWriter
from torch.nn.utils.rnn import pad_sequence
+from funasr.train_utils.device_funcs import to_device
class VadStateMachine(Enum):
kVadInStateStartPointNotDetected = 1
@@ -554,7 +555,8 @@
meta_data[
"batch_data_time"] = speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000
- speech.to(device=kwargs["device"]), speech_lengths.to(device=kwargs["device"])
+ speech = speech.to(device=kwargs["device"])
+ speech_lengths = speech_lengths.to(device=kwargs["device"])
# b. Forward Encoder streaming
t_offset = 0
@@ -579,7 +581,8 @@
"cache": cache
}
-
+
+ batch = to_device(batch, device=kwargs["device"])
segments_part, cache = self.forward(**batch)
if segments_part:
for batch_num in range(0, batch_size):
--
Gitblit v1.9.1