def restore(self, checkpoint_path):
    state = torch.load(checkpoint_path, map_location=self.cfg.device)
    self.model.load_state_dict(state['model'])
    self.optimizer.load_state_dict(state['optimizer'])
    self.lr = state['lr']
    best_err = state['best_err']
    curr_err = state['curr_err']
    print('load from lr {}, curr_avg {}, best_avg {}.'.format(state['lr'], curr_err, best_err))
def restore(self, checkpoint_path):
    state = torch.load(checkpoint_path, map_location=self.cfg.device)
    self.model.load_state_dict(state['model'])
    self.optimizer.load_state_dict(state['optimizer'])
    self.lr = state['lr']
    best_err = state['best_err']
    curr_err = state['curr_err']
    print('load from lr {}, curr_avg {}, best_avg {}.'.format(state['lr'], curr_err, best_err))