Skip to content

Commit 6c07247

Browse files
committed
fix a bug
1 parent eb4edad commit 6c07247

File tree

1 file changed

+5
-6
lines changed
  • paddlespeech/s2t/exps/deepspeech2

1 file changed

+5
-6
lines changed

paddlespeech/s2t/exps/deepspeech2/model.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,15 @@ def compute_result_transcripts(self, audio, audio_len):
417417
audio, audio_len, decoder_chunk_size=1)
418418
result_transcripts = trans[-1:]
419419
elif self.args.model_type == "offline":
420-
batch_size = output_probs.shape[0]
421-
self.model.decoder.reset_decoder(batch_size = batch_size)
422420
output_probs, output_lens = self.static_forward_offline(audio,
423421
audio_len)
422+
batch_size = output_probs.shape[0]
423+
self.model.decoder.reset_decoder(batch_size=batch_size)
424424

425425
self.model.decoder.next(output_probs, output_lens)
426426

427427
trans_best, trans_beam = self.model.decoder.decode()
428-
428+
429429
result_transcripts = trans_best
430430

431431
else:
@@ -524,8 +524,8 @@ def static_forward_online(self, audio, audio_len,
524524
if self.args.enable_auto_log is True:
525525
# record the model preprocessing time
526526
self.autolog.times.stamp()
527-
528-
self.model.decoder.reset_decoder(batch_size = 1)
527+
528+
self.model.decoder.reset_decoder(batch_size=1)
529529
for i in range(0, num_chunk):
530530
start = i * chunk_stride
531531
end = start + chunk_size
@@ -569,7 +569,6 @@ def static_forward_online(self, audio, audio_len,
569569
probs_chunk_lens_list.append(output_chunk_lens)
570570
trans_best, trans_beam = self.model.decoder.decode()
571571
trans.append(trans_best[0])
572-
573572

574573
output_probs = np.concatenate(probs_chunk_list, axis=1)
575574
output_lens = np.sum(probs_chunk_lens_list, axis=0)

0 commit comments

Comments
 (0)