in svoice/solver.py [0:0]
def _reset(self):
load_from = None
# Reset
if self.checkpoint and self.checkpoint.exists() and not self.restart:
load_from = self.checkpoint
elif self.continue_from:
load_from = self.continue_from
if load_from:
logger.info(f'Loading checkpoint model: {load_from}')
package = torch.load(load_from, 'cpu')
if load_from == self.continue_from and self.args.continue_best:
self.model.load_state_dict(package['best_state'])
else:
self.model.load_state_dict(package['model']['state'])
if 'optimizer' in package and not self.args.continue_best:
self.optimizer.load_state_dict(package['optimizer'])
self.history = package['history']
self.best_state = package['best_state']