assert that vocab size >= adaptive softmax cutoff
@@ -22,6 +22,9 @@ class AdaptiveSoftmax(nn.Module):
if vocab_size > cutoff[-1]:
cutoff = cutoff + [vocab_size]
+ else:
+ assert vocab_size == cutoff[
+ -1], 'cannot specify cutoff smaller than vocab size'
output_dim = cutoff[0] + len(cutoff) - 1
