From eed5cbb9457f0842d9ea8f41cd88459a5dbc9e70 Mon Sep 17 00:00:00 2001
From: haoneng.lhn <haoneng.lhn@alibaba-inc.com>
Date: 星期二, 12 九月 2023 12:55:19 +0800
Subject: [PATCH] fix decoding_ind none bug
---
funasr/bin/asr_infer.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/funasr/bin/asr_infer.py b/funasr/bin/asr_infer.py
index 2e002b7..79ab974 100644
--- a/funasr/bin/asr_infer.py
+++ b/funasr/bin/asr_infer.py
@@ -399,7 +399,7 @@
@torch.no_grad()
def __call__(
self, speech: Union[torch.Tensor, np.ndarray], speech_lengths: Union[torch.Tensor, np.ndarray] = None,
- begin_time: int = 0, end_time: int = None,
+ decoding_ind: int = None, begin_time: int = 0, end_time: int = None,
):
"""Inference
@@ -429,7 +429,11 @@
batch = to_device(batch, device=self.device)
# b. Forward Encoder
- enc, enc_len = self.asr_model.encode(**batch, ind=self.decoding_ind)
+ if decoding_ind is None:
+ decoding_ind = self.decoding_ind
+ if self.decoding_ind is None:
+ decoding_ind = 0
+ enc, enc_len = self.asr_model.encode(**batch, ind=decoding_ind)
if isinstance(enc, tuple):
enc = enc[0]
# assert len(enc) == 1, len(enc)
--
Gitblit v1.9.1