a7cd7a15a9baf741f2b4fcd32f3d8055827889b5,examples/word_language_model/predict.py,,,#,11
Before Change
hidden = learner.module_.init_hidden(1)
input = Variable(torch.rand(1, 1).mul(ntokens).long(), volatile=True)
if args.cuda:
input = input.cuda()
p = learner.predict_proba(np.array([[
corpus.dictionary.word2idx["fish"],
corpus.dictionary.word2idx["sees"],
corpus.dictionary.word2idx["man"],
After Change
learner.initialize()
learner.load_params(args.checkpoint)
words = [corpus.dictionary.idx2word[n] for n in range(10)]
print(words)
p = learner.predict_proba(np.array([[
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: dnouri/skorch
Commit Name: a7cd7a15a9baf741f2b4fcd32f3d8055827889b5
Time: 2017-08-08
Author: marian.tietz@ottogroup.com
File Name: examples/word_language_model/predict.py
Class Name:
Method Name:
Project Name: facebookresearch/ParlAI
Commit Name: 72e28f315e6458993407beb4d7041ccebca90735
Time: 2018-10-16
Author: bhancock@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: _build_candidates
Project Name: Shawn1993/cnn-text-classification-pytorch
Commit Name: 5c177f3d9a29fc7737bd4734315820d1c11c7e87
Time: 2019-07-17
Author: rriva002@ucr.edu
File Name: cnn_text_classification.py
Class Name: CNNClassifier
Method Name: predict