Commit cc7705d3 authored by Myle Ott's avatar Myle Ott
Browse files

Fix generation bug with large beam sizes (>50)

parent 9430544a
Loading
Loading
Loading
Loading
+1 −1
Changes for fairseq/sequence_generator.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ class SequenceGenerator(object):
            # and values < cand_size indicate candidate active hypos.
            # After, the min values per row are the top candidate active hypos
            active_mask = buffer('active_mask')
            torch.add((eos_mask*cand_size).type_as(cand_offsets), cand_offsets[:eos_mask.size(1)],
            torch.add(eos_mask.type_as(cand_offsets)*cand_size, cand_offsets[:eos_mask.size(1)],
                      out=active_mask)

            # get the top beam_size active hypotheses, which are just the hypos