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

Better error message for --decoder-attention

parent a09fe803
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment