Unverified Commit f26b6aff authored by Alexei Baevski's avatar Alexei Baevski Committed by GitHub
Browse files

assert that vocab size >= adaptive softmax cutoff (#214)

parent 1d79ed9b
Loading
Loading
Loading
Loading
+3 −0
Changes for fairseq/modules/adaptive_softmax.py: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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