Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

Commit 473389a

Browse files
jiajunshenfacebook-github-bot
authored andcommitted
Small bug fix for generation when batch_size is small
Summary: Pull Request resolved: fairinternal/fairseq-py#727 Differential Revision: D16332742 Pulled By: myleott fbshipit-source-id: becedd573c2c071fd21fcb5e55fead554c9bd9d1
1 parent 61e328c commit 473389a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def main(args):
135135
print('T-{}\t{}'.format(sample_id, target_str))
136136

137137
# Process top predictions
138-
for j, hypo in enumerate(hypos[i][:min(len(hypos), args.nbest)]):
138+
for j, hypo in enumerate(hypos[i][:args.nbest]):
139139
hypo_tokens, hypo_str, alignment = utils.post_process_prediction(
140140
hypo_tokens=hypo['tokens'].int().cpu(),
141141
src_str=src_str,

0 commit comments

Comments
 (0)