예제 #1
0
 def setUp(self):
     vocab = Vocabulary('<unk>', 0)
     vocab.add_from_text('a b c')
     model = LSTMLanguageModel(len(vocab),
                               ninp=10,
                               nhid=10,
                               nlayers=2,
                               dropout=0.0)
     decoder = FullSoftmaxDecoder(10, len(vocab))
     self.lm = LanguageModel(model, decoder, vocab)
예제 #2
0
 def setUp(self):
     vocab = Vocabulary('<unk>', 0)
     vocab.add_from_text('a b c')
     encoder = FlatEmbedding(len(vocab), 10)
     model = LSTMLanguageModel(encoder,
                               dim_input=10,
                               dim_lstm=10,
                               nb_layers=2,
                               dropout=0.0)
     decoder = FullSoftmaxDecoder(10, len(vocab))
     self.lm = LanguageModel(model, decoder, vocab)
예제 #3
0
 def setUp(self):
     vocab = Vocabulary('<unk>', 0)
     vocab.add_from_text('a b c')
     model = FakeModel()
     decoder = FakeDecoder()
     self.lm = LanguageModel(model, decoder, vocab)