Minor fixes.

This commit is contained in:
Fangjun Kuang 2021-11-11 19:35:53 +08:00
parent 3bcdecda44
commit 940aedf7ce

View File

@ -479,14 +479,13 @@ def decode_dataset(
assert ( assert (
len(results) > 0 len(results) > 0
), "It should not decode to empty in the first batch!" ), "It should not decode to empty in the first batch!"
keys = list(results.keys())
for lm_scale in keys:
this_batch = [] this_batch = []
hyp_words = [] hyp_words = []
for ref_text in texts: for ref_text in texts:
ref_words = ref_text.split() ref_words = ref_text.split()
this_batch.append((ref_words, hyp_words)) this_batch.append((ref_words, hyp_words))
for lm_scale in results.keys():
results[lm_scale].extend(this_batch) results[lm_scale].extend(this_batch)
num_cuts += len(texts) num_cuts += len(texts)