b9086766daa77fe7de12de859f342ab5aec47bad,ch12/use_model.py,,,#,51

Before Change


    emb_dict, emb = data.load_embeddings(os.path.dirname(args.model))
    log.info("Embeddings loaded, shape=%s", emb.shape)

    embeddings = nn.Embedding(num_embeddings=emb.shape[0], embedding_dim=emb.shape[1])
    embeddings.weight.data.copy_(torch.from_numpy(emb))
    embeddings.weight.requires_grad = False

    net = model.PhraseModel(emb_size=emb.shape[1], dict_size=emb.shape[0], hid_size=model.HIDDEN_STATE_SIZE)
    net.load_state_dict(torch.load(args.model))

After Change


    args = parser.parse_args()

    emb_dict = data.load_emb_dict(os.path.dirname(args.model))
    net = model.PhraseModel(emb_size=model.EMBEDDING_DIM, dict_size=len(emb_dict), hid_size=model.HIDDEN_STATE_SIZE)
    net.load_state_dict(torch.load(args.model))

    rev_emb_dict = {idx: word for word, idx in emb_dict.items()}
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: b9086766daa77fe7de12de859f342ab5aec47bad
Time: 2018-01-10
Author: max.lapan@gmail.com
File Name: ch12/use_model.py
Class Name:
Method Name:


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: b9086766daa77fe7de12de859f342ab5aec47bad
Time: 2018-01-10
Author: max.lapan@gmail.com
File Name: ch12/use_model.py
Class Name:
Method Name:


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 8d36775e23b0cea21b7996ec4c0c21915a8afed7
Time: 2018-01-06
Author: max.lapan@gmail.com
File Name: ch12/train_scst.py
Class Name:
Method Name:


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 20d1da406aaa2ae2a32c48a28e3efe4f475d7398
Time: 2018-01-06
Author: max.lapan@gmail.com
File Name: ch12/train_crossent.py
Class Name:
Method Name: