1db3e4b5d647adef9811fa74ab8c6bf3638ade62,onmt/Translator.py,Translator,__init__,#Translator#Any#,7
Before Change
self.tt = torch.cuda if opt.cuda else torch
checkpoint = torch.load(opt.model)
self.model = checkpoint["model"]
self.model.eval()
if opt.cuda:
self.model.cuda()
else:
self.model.cpu()
self.src_dict = checkpoint["dicts"]["src"]
self.tgt_dict = checkpoint["dicts"]["tgt"]
After Change
nn.Linear(model_opt.rnn_size, self.tgt_dict.size()),
nn.LogSoftmax())
model.load_state_dict(checkpoint["model"])
generator.load_state_dict(checkpoint["generator"])
if opt.cuda:
model.cuda()
generator.cuda()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 1db3e4b5d647adef9811fa74ab8c6bf3638ade62
Time: 2017-03-14
Author: bryan.mccann.is@gmail.com
File Name: onmt/Translator.py
Class Name: Translator
Method Name: __init__
Project Name: pytorch/examples
Commit Name: 4af62f988aef58b076904ab0e8dffef1ea6b4840
Time: 2017-03-14
Author: bryan.mccann.is@gmail.com
File Name: OpenNMT/train.py
Class Name:
Method Name: main
Project Name: pytorch/examples
Commit Name: 988ee51b15466231e9770f46dcb4d221866322a7
Time: 2017-03-14
Author: bryan.mccann.is@gmail.com
File Name: OpenNMT/onmt/Translator.py
Class Name: Translator
Method Name: __init__