fabb8b5bafea7151b48d9dbbeefaeae87b312c34,tools/extract_embeddings.py,,main,#,30
Before Change
feat_padding_idx,
len(tgt_dict),
for_encoder=False)
decoder = make_decoder(model_opt.decoder_type,
model_opt.rnn_type,
model_opt.brnn,
model_opt.dec_layers,
model_opt.rnn_size,
model_opt.input_feed,
model_opt.global_attention,
model_opt.coverage_attn,
model_opt.context_gate,
model_opt.copy_attn,
model_opt.cnn_kernel_width,
model_opt.dropout,
embeddings)
encoder_embeddings = encoder.word_lut.weight.data.tolist()
decoder_embeddings = decoder.word_lut.weight.data.tolist()
After Change
if opt.cuda:
torch.cuda.set_device(opt.gpu)
model_opt = checkpoint["opt"]
src_dict = checkpoint["dicts"]["src"]
tgt_dict = checkpoint["dicts"]["tgt"]
feat_padding_idx = []
embeddings = make_embeddings(model_opt,
src_dict.stoi[onmt.IO.PAD_WORD],
feat_padding_idx,
len(src_dict),
for_encoder=True)
encoder = make_encoder(model_opt, embeddings)
embeddings = make_embeddings(model_opt,
tgt_dict.stoi[onmt.IO.PAD_WORD],
feat_padding_idx,
len(tgt_dict),
for_encoder=False)
decoder = make_decoder(model_opt, embeddings)
encoder_embeddings = encoder.word_lut.weight.data.tolist()
decoder_embeddings = decoder.word_lut.weight.data.tolist()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 16
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: fabb8b5bafea7151b48d9dbbeefaeae87b312c34
Time: 2017-09-11
Author: nasa4836@gmail.com
File Name: tools/extract_embeddings.py
Class Name:
Method Name: main
Project Name: OpenNMT/OpenNMT-py
Commit Name: fabb8b5bafea7151b48d9dbbeefaeae87b312c34
Time: 2017-09-11
Author: nasa4836@gmail.com
File Name: onmt/ModelConstructor.py
Class Name:
Method Name: make_base_model
Project Name: OpenNMT/OpenNMT-py
Commit Name: fabb8b5bafea7151b48d9dbbeefaeae87b312c34
Time: 2017-09-11
Author: nasa4836@gmail.com
File Name: tools/extract_embeddings.py
Class Name:
Method Name: main
Project Name: OpenNMT/OpenNMT-py
Commit Name: fabb8b5bafea7151b48d9dbbeefaeae87b312c34
Time: 2017-09-11
Author: nasa4836@gmail.com
File Name: test/test_models.py
Class Name: TestModel
Method Name: ntmmodel_forward