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

Better error message for --decoder-attention

parent a09fe803
Loading
Loading
Loading
Loading
+3 −0
Changes for fairseq/models/fconv.py: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -163,6 +163,9 @@ class FConvDecoder(FairseqIncrementalDecoder):
        if isinstance(attention, bool):
            # expand True into [True, True, ...] and do the same with False
            attention = [attention] * len(convolutions)
        if not isinstance(attention, list) or len(attention) != len(convolutions):
            raise ValueError('Attention is expected to be a list of booleans of '
                             'length equal to the number of layers.')

        num_embeddings = len(dictionary)
        padding_idx = dictionary.pad()