Commit 2d3161da authored by Sergey Edunov's avatar Sergey Edunov
Browse files

Issue #2, Checking size attribute of dst when dst is None

parent a6155337
Loading
Loading
Loading
Loading
+1 −1
Changes for fairseq/data.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ def batches_by_size(src, batch_size=None, max_tokens=None, dst=None, max_positio
        # - 2 here stems from make_positions() where we offset positions
        # by padding_value + 1
        if src.sizes[idx] < 2 or \
                (dst is not None and dst.sizes[idx] < 2) or \
                (False if dst is None else dst.sizes[idx] < 2) or \
                sizes[idx] > max_positions - 2:
            raise Exception("Unable to handle input id {} of "
                            "size {} / {}.".format(idx, src.sizes[idx], dst.sizes[idx]))