Skip to content

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackwaterveg committed Jan 24, 2022
1 parent eb4edad commit 6c07247
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions paddlespeech/s2t/exps/deepspeech2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,15 @@ def compute_result_transcripts(self, audio, audio_len):
audio, audio_len, decoder_chunk_size=1)
result_transcripts = trans[-1:]
elif self.args.model_type == "offline":
batch_size = output_probs.shape[0]
self.model.decoder.reset_decoder(batch_size = batch_size)
output_probs, output_lens = self.static_forward_offline(audio,
audio_len)
batch_size = output_probs.shape[0]
self.model.decoder.reset_decoder(batch_size=batch_size)

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

trans_best, trans_beam = self.model.decoder.decode()

result_transcripts = trans_best

else:
Expand Down Expand Up @@ -524,8 +524,8 @@ def static_forward_online(self, audio, audio_len,
if self.args.enable_auto_log is True:
# record the model preprocessing time
self.autolog.times.stamp()
self.model.decoder.reset_decoder(batch_size = 1)

self.model.decoder.reset_decoder(batch_size=1)
for i in range(0, num_chunk):
start = i * chunk_stride
end = start + chunk_size
Expand Down Expand Up @@ -569,7 +569,6 @@ def static_forward_online(self, audio, audio_len,
probs_chunk_lens_list.append(output_chunk_lens)
trans_best, trans_beam = self.model.decoder.decode()
trans.append(trans_best[0])


output_probs = np.concatenate(probs_chunk_list, axis=1)
output_lens = np.sum(probs_chunk_lens_list, axis=0)
Expand Down

0 comments on commit 6c07247

Please sign in to comment.