mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-12-11 06:55:27 +00:00
from local
This commit is contained in:
parent
24ae0d3a63
commit
64b4e778c9
Binary file not shown.
@ -205,17 +205,20 @@ def decode_one_batch_greedy(
|
||||
else:
|
||||
assert HLG is None
|
||||
decoding_graph = H
|
||||
|
||||
hyps = []
|
||||
|
||||
if params.method == 'greedy-search' or params.method == 'ctc-decoding':
|
||||
batch_size = nnet_output.size(0)
|
||||
for i in range(batch_size):
|
||||
topk_log_probs, topk_indexes = nnet_output[i].topk(1)
|
||||
topk_indexes = topk_indexes.squeeze().unique_consecutive()
|
||||
topk_indexes = topk_indexes[topk_indexes != 0]
|
||||
hyp = ''
|
||||
for idx in topk_indexes:
|
||||
hyp += token_dict[idx.item()]
|
||||
print(hyp)
|
||||
batch_size = nnet_output.size(0)
|
||||
for i in range(batch_size):
|
||||
topk_log_probs, topk_indexes = nnet_output[i].topk(1)
|
||||
topk_indexes = topk_indexes.squeeze().unique_consecutive()
|
||||
topk_indexes = topk_indexes[topk_indexes != 0]
|
||||
hyp = ''
|
||||
for idx in topk_indexes:
|
||||
hyp += token_dict[idx.item()]
|
||||
hyps.append(hyp)
|
||||
|
||||
return hyps
|
||||
|
||||
|
||||
def decode_one_batch(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user