There was an error while loading. Please reload this page.
1 parent 18df41e commit f2a771aCopy full SHA for f2a771a
word_language_model/model.py
@@ -26,6 +26,8 @@ def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, tie_weigh
26
# "Tying Word Vectors and Word Classifiers: A Loss Framework for Language Modeling" (Inan et al. 2016)
27
# https://arxiv.org/abs/1611.01462
28
if tie_weights:
29
+ if nhid != ninp:
30
+ raise ValueError('When using the tied flag, nhid must be equal to emsize')
31
self.decoder.weight = self.encoder.weight
32
33
self.init_weights()
0 commit comments