def load_checkpoint(self, file_name):
    filename = (self.config.checkpoint_dir + file_name)
    try:
        self.logger.info("Loading checkpoint '{}'".format(filename))
        checkpoint = torch.load(filename)
        self.current_episode = checkpoint['episode']
        self.current_iteration = checkpoint['iteration']
        self.policy_model.load_state_dict(checkpoint['state_dict'])
        self.optim.load_state_dict(checkpoint['optimizer'])
        self.logger.info("Checkpoint loaded successfully from '{}' at (epoch {}) at (iteration {})\n".format(self.config.checkpoint_dir, checkpoint['episode'], checkpoint['iteration']))
    except OSError as e:
        self.logger.info("No checkpoint exists from '{}'. Skipping...".format(self.config.checkpoint_dir))
        self.logger.info('**First time to train**')
def load_checkpoint(self, file_name):
    filename = (self.config.checkpoint_dir + file_name)
    try:
        self.logger.info("Loading checkpoint '{}'".format(filename))
        checkpoint = torch.load(filename)
        self.current_episode = checkpoint['episode']
        self.current_iteration = checkpoint['iteration']
        self.policy_model.load_state_dict(checkpoint['state_dict'])
        self.optim.load_state_dict(checkpoint['optimizer'])
        self.logger.info("Checkpoint loaded successfully from '{}' at (epoch {}) at (iteration {})\n".format(self.config.checkpoint_dir, checkpoint['episode'], checkpoint['iteration']))
    except OSError as e:
        self.logger.info("No checkpoint exists from '{}'. Skipping...".format(self.config.checkpoint_dir))
        self.logger.info('**First time to train**')