I used following code to save model weights. It successfully saves for first time and but throws error while saving weights second time. The error is shown in the attached snapshot. What could be the possible solution?
state = model.state_dict() def save_checkpoint(state, is_best, filename='checkpoint.pth.tar'): """Save checkpoint if a new best is achieved""" torch.save(state, filename) if is_best: print('\t=> Saving new best weights') shutil.copyfile(filename,'model_bestweights.pth.tar') #save checkpoint else: print('\t=> Validation accuracy did not improve')