Merge pull request #398 from alibaba-damo-academy/dev_zly2

vad
This commit is contained in:
zhifu gao 2023-04-21 23:21:34 +08:00 committed by GitHub
commit 49909f904c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -109,7 +109,7 @@ class Speech2VadSegment:
fbanks, fbanks_len = self.frontend.forward_fbank(speech, speech_lengths) fbanks, fbanks_len = self.frontend.forward_fbank(speech, speech_lengths)
feats, feats_len = self.frontend.forward_lfr_cmvn(fbanks, fbanks_len) feats, feats_len = self.frontend.forward_lfr_cmvn(fbanks, fbanks_len)
fbanks = to_device(fbanks, device=self.device) fbanks = to_device(fbanks, device=self.device)
# feats = to_device(feats, device=self.device) feats = to_device(feats, device=self.device)
feats_len = feats_len.int() feats_len = feats_len.int()
else: else:
raise Exception("Need to extract feats first, please configure frontend configuration") raise Exception("Need to extract feats first, please configure frontend configuration")
@ -131,7 +131,7 @@ class Speech2VadSegment:
"in_cache": in_cache "in_cache": in_cache
} }
# a. To device # a. To device
batch = to_device(batch, device=self.device) #batch = to_device(batch, device=self.device)
segments_part, in_cache = self.vad_model(**batch) segments_part, in_cache = self.vad_model(**batch)
if segments_part: if segments_part:
for batch_num in range(0, self.batch_size): for batch_num in range(0, self.batch_size):

View File

@ -34,7 +34,7 @@ def load_cmvn(cmvn_file):
means = np.array(means_list).astype(np.float) means = np.array(means_list).astype(np.float)
vars = np.array(vars_list).astype(np.float) vars = np.array(vars_list).astype(np.float)
cmvn = np.array([means, vars]) cmvn = np.array([means, vars])
cmvn = torch.as_tensor(cmvn, dype=torch.float32) cmvn = torch.as_tensor(cmvn, dtype=torch.float32)
return cmvn return cmvn