def _end_epoch(self, epoch): self._log_stats(epoch) self.expl_data_collector.end_epoch(epoch) ray.get([self.remote_eval_data_collector.end_epoch.remote(epoch)]) self.replay_buffer.end_epoch(epoch) self.trainer.end_epoch(epoch) # We can only save the state of the program # after we call end epoch on all objects with internal state. # This is so that restoring from the saved state will # lead to identical result as if the program was left running. snapshot = self._get_snapshot(epoch) logger.save_itr_params(epoch + 1, snapshot) gt.stamp('saving') logger.record_dict(_get_epoch_timings()) logger.record_tabular('Epoch', epoch) write_header = True if epoch == 0 else False logger.dump_tabular(with_prefix=False, with_timestamp=False, write_header=write_header)
def _end_epoch(self, epoch): self._log_stats(epoch) if epoch > 0: snapshot = self._get_snapshot(epoch) logger.save_itr_params(epoch + 1, snapshot) gt.stamp('saving', unique=False) self.trainer.end_epoch(epoch) logger.record_dict(_get_epoch_timings()) logger.record_tabular('Epoch', epoch) write_header = True if epoch == 0 else False logger.dump_tabular(with_prefix=False, with_timestamp=False, write_header=write_header)
def new_add_scalar(key, value, step): if isinstance(value, torch.Tensor): value = ptu.get_numpy(value) old_add_scalar(key, value, step) logger.record_tabular(key, value)