25c64fdd9a89337c9eacac730912ba275dbaae8c,torchreid/utils/torchtools.py,,resume_from_checkpoint,#Any#Any#Any#,37

Before Change



def resume_from_checkpoint(ckpt_path, model, optimizer=None):
    print("Loading checkpoint from "{}"".format(ckpt_path))
    ckpt = torch.load(ckpt_path)
    model.load_state_dict(ckpt["state_dict"])
    print("Loaded model weights")
    if optimizer is not None:
        optimizer.load_state_dict(ckpt["optimizer"])

After Change



def resume_from_checkpoint(fpath, model, optimizer=None):
    print("Loading checkpoint from "{}"".format(fpath))
    checkpoint = load_checkpoint(fpath)
    model.load_state_dict(checkpoint["state_dict"])
    print("Loaded model weights")
    if optimizer is not None and "optimizer" in checkpoint.keys():
        optimizer.load_state_dict(checkpoint["optimizer"])
        print("Loaded optimizer")
    start_epoch = checkpoint["epoch"]
    print("Last epoch = {}".format(start_epoch))
    if "rank1" in checkpoint.keys():
        print("Last rank1 = {:.1%}".format(checkpoint["rank1"]))
    return start_epoch
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: KaiyangZhou/deep-person-reid
Commit Name: 25c64fdd9a89337c9eacac730912ba275dbaae8c
Time: 2019-03-08
Author: k.zhou@qmul.ac.uk
File Name: torchreid/utils/torchtools.py
Class Name:
Method Name: resume_from_checkpoint


Project Name: senarvi/theanolm
Commit Name: bcf723a2f67a372e6b03a453149a82ecf2766fff
Time: 2015-12-24
Author: seppo.git@marjaniemi.com
File Name: theanolm/commands/train.py
Class Name:
Method Name: train


Project Name: junyanz/interactive-deep-colorization
Commit Name: b813baa342a7ab979362f111a9adb4f6a1f0127c
Time: 2018-09-10
Author: junyanzhu89@gmail.com
File Name: data/colorize_image.py
Class Name: ColorizeImageTorch
Method Name: prep_net