How can I save the scheduler state ?
I tried :
temp = scheduler.state_dict()
temp['last_epoch']=36
but got the error
AttributeError: ‘MultiStepLR’ object has no attribute ‘state_dict’
The reason I’m trying this is , I forgot to save the scheduler setting along with other needed info when saving the checkpoint! so now that I need to resume tarining, I need to choose the correct epoch. I thought the best way would be to manually create a new dictionary for it and then use load_state_dict()
with the new information and carry on.
I dont know why I’m facing this error, I saw for saving, people simply do :
save_checkpoint({
'epoch': epoch + 1,
'arch': args.arch,
'state_dict': model.state_dict(),
'best_prec1': best_prec1,
'best_prec5': best_prec5,
'optimizer' : optimizer.state_dict(),
'scheduler' : scheduler.state_dict()
}, is_best, filename, bestname)
def save_checkpoint(state, is_best, filename, bestname):
torch.save(state, filename)
if is_best:
shutil.copyfile(filename, bestname)
so as you can see the scheduler has a state_dict(). Can anyone tell me where the problem is and how I can fix it?