79fc09d66d3f4736b9fb4f5756a78725719f3808,train.py,,train,#Any#,27

Before Change


    optimizer = optim.Adam(model.parameters(), lr=opt.learning_rate)

    // Load the optimizer
    if infos.get("state_dict", None):
        optimizer.load_state_dict(infos["state_dict"])

    while True:

After Change



                if best_flag:
                    checkpoint_path = os.path.join(opt.checkpoint_path, "model-best.ckpt")
                    torch.save(model.state_dict(), checkpoint_path)
                    print("model saved to {}".format(checkpoint_path))
                    with open(os.path.join(opt.checkpoint_path, "infos_"+opt.id+"-best.pkl"), "wb") as f:
                        cPickle.dump(infos, f)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 2

Instances


Project Name: ruotianluo/ImageCaptioning.pytorch
Commit Name: 79fc09d66d3f4736b9fb4f5756a78725719f3808
Time: 2017-02-10
Author: rluo@ttic.edu
File Name: train.py
Class Name:
Method Name: train


Project Name: ruotianluo/self-critical.pytorch
Commit Name: 30a0e7b4b572b1a48d64d2f7f3574493fd3c7d56
Time: 2019-12-26
Author: rluo@ttic.edu
File Name: train.py
Class Name:
Method Name: train