pytorch_generative/trainer.py
def load_from_checkpoint(self):
        """Attempts to load Trainer state from the internal log_dir."""
        self._model.load_state_dict(torch.load(self._path(self.hp_str + "_model_state")))
        self._optimizer.load_state_dict(torch.load(self._path(self.hp_str + "_optimizer_state")))
        if self._lr_scheduler is not None:
            self._lr_scheduler.load_state_dict(
                torch.load(self._path(self.hp_str + "_lr_scheduler_state"))
            )
        self._step = torch.load(self._path(self.hp_str + "_step"))
        self._epoch = torch.load(self._path(self.hp_str + "_epoch"))
        self._examples_processed = torch.load(self._path(self.hp_str + "_examples_processed"))
        self._time_taken = torch.load(self._path(self.hp_str + "_time_taken"))
        # NOTE(eugenhotaj): We need to replace the SummaryWriter and ensure any
        # logs written after the last saved checkpoint are purged.
        self._summary_writer.close()
        self._summary_writer = tensorboard.SummaryWriter(
            self._log_dir, max_queue=100, purge_step=self._step
        )
Attempts to load Trainer state from the internal log_dir.
Attempts to load Trainer state from the internal log_dir.
Attempts to load Trainer state from the internal log_dir .
def load_from_checkpoint(self):
        self._model.load_state_dict(torch.load(self._path(self.hp_str + "_model_state")))
        self._optimizer.load_state_dict(torch.load(self._path(self.hp_str + "_optimizer_state")))
        if self._lr_scheduler is not None:
            self._lr_scheduler.load_state_dict(
                torch.load(self._path(self.hp_str + "_lr_scheduler_state"))
            )
        self._step = torch.load(self._path(self.hp_str + "_step"))
        self._epoch = torch.load(self._path(self.hp_str + "_epoch"))
        self._examples_processed = torch.load(self._path(self.hp_str + "_examples_processed"))
        self._time_taken = torch.load(self._path(self.hp_str + "_time_taken"))
        self._summary_writer.close()
        self._summary_writer = tensorboard.SummaryWriter(
            self._log_dir, max_queue=100, purge_step=self._step
        )
def load_from_checkpoint ( self ) : self . _model . load_state_dict ( torch . load ( self . _path ( self . hp_str + "_model_state" ) ) ) self . _optimizer . load_state_dict ( torch . load ( self . _path ( self . hp_str + "_optimizer_state" ) ) ) if self . _lr_scheduler is not None : self . _lr_scheduler . load_state_dict ( torch . load ( self . _path ( self . hp_str + "_lr_scheduler_state" ) ) ) self . _step = torch . load ( self . _path ( self . hp_str + "_step" ) ) self . _epoch = torch . load ( self . _path ( self . hp_str + "_epoch" ) ) self . _examples_processed = torch . load ( self . _path ( self . hp_str + "_examples_processed" ) ) self . _time_taken = torch . load ( self . _path ( self . hp_str + "_time_taken" ) ) self . _summary_writer . close ( ) self . _summary_writer = tensorboard . SummaryWriter ( self . _log_dir , max_queue = 100 , purge_step = self . _step )
Attempts to load Trainer state from the internal log_dir.
Attempts to load Trainer state from the internal log_dir .
"""Attempts to load Trainer state from the internal log_dir.""" # NOTE(eugenhotaj): We need to replace the SummaryWriter and ensure any # logs written after the last saved checkpoint are purged.
self