Some error on resuming training from checkpoint
e96031413 opened this issue · comments
Yanwei Liu commented
Hello, thanks for your great work, I found some error in the main.py
I have attached the right version below:
- parser should look like this to load the checkpoint.
parser.add_argument('--resume', default='', type=str, metavar='PATH',
help='path to latest checkpoint (default: none)')
- when loading the model, we should use the correct checkpoint name.
if args.resume:
if os.path.isfile(args.resume):
print("=> loading checkpoint '{}'".format(args.resume))
checkpoint = torch.load(args.resume)
start_step = checkpoint['step']
# best_acc = checkpoint['best_acc']
G.load_state_dict(checkpoint['state_dict_G'])
optimizer_g.load_state_dict(checkpoint['optimizer_G']) # checkpoint['optimizer_g'] in your code
F1.load_state_dict(checkpoint['state_dict_F']) # checkpoint['state_dict_G'] in your code
optimizer_f.load_state_dict(checkpoint['optimizer_f'])
Kai Li commented
Thanks, we will revise accordingly.