988ee51b15466231e9770f46dcb4d221866322a7,OpenNMT/onmt/Translator.py,Translator,__init__,#Translator#Any#,7
Before Change
if opt.cuda:
self.model.cuda()
else:
self.model.cpu()
self.src_dict = checkpoint["dicts"]["src"]
self.tgt_dict = checkpoint["dicts"]["tgt"]
After Change
checkpoint = torch.load(opt.model)
model_opt = checkpoint["opt"]
self.src_dict = checkpoint["dicts"]["src"]
self.tgt_dict = checkpoint["dicts"]["tgt"]
encoder = onmt.Models.Encoder(model_opt, self.src_dict)
decoder = onmt.Models.Decoder(model_opt, self.tgt_dict)
model = onmt.Models.NMTModel(encoder, decoder)
generator = nn.Sequential(
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()
else:
model.cpu()
generator.cpu()
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 5
Instances
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__
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: mozilla/TTS
Commit Name: 3b57e88a66ba1f410be70dbd2ad2899b5b1bcb0e
Time: 2020-02-19
Author: reuben.morais@gmail.com
File Name: server/synthesizer.py
Class Name: Synthesizer
Method Name: tts
Project Name: mozilla/TTS
Commit Name: 02e6d0538272f589d6c3c290b81575b7bd866991
Time: 2020-02-13
Author: reuben.morais@gmail.com
File Name: server/synthesizer.py
Class Name: Synthesizer
Method Name: tts