Triggers operation to save checkpoints This method will trigger the Save ops to serialize and persist the blobs present in the global workspaace. Args: epoch: An integer. The checkpoint epoch-id that we are saving. session: A Session object to execut
(self, epoch, session)
| 787 | return result |
| 788 | |
| 789 | def save_checkpoints(self, epoch, session): |
| 790 | """Triggers operation to save checkpoints |
| 791 | |
| 792 | This method will trigger the Save ops to serialize and persist the |
| 793 | blobs present in the global workspaace. |
| 794 | |
| 795 | Args: |
| 796 | epoch: An integer. The checkpoint epoch-id that we are saving. |
| 797 | session: A Session object to execute the save ops. |
| 798 | |
| 799 | Raises: |
| 800 | ValueError: When the checkpoint manager is invalid. |
| 801 | """ |
| 802 | if not self.checkpoint_manager: |
| 803 | raise ValueError('Checkpoint manager is None') |
| 804 | try: |
| 805 | is_accessible = self.checkpoint_manager.cp_accessible(epoch=None) |
| 806 | if is_accessible: |
| 807 | logger.info('Saving checkpoints for epoch {}'.format(epoch)) |
| 808 | session.run(self.checkpoint_manager.save(epoch)) |
| 809 | self.checkpoint_manager.write_checkpoint_metadata(epoch) |
| 810 | logger.info('Checkpoints saved') |
| 811 | self.checkpoint_manager.report_checkpoint_stats('checkpoint_save') |
| 812 | else: |
| 813 | logger.warning("Checkpoint files cannot be accessed!") |
| 814 | except Exception as ex: |
| 815 | logger.warning("Unable to write checkpoint for epoch {}. Error={}". |
| 816 | format(epoch, ex)) |
| 817 | |
| 818 | |
| 819 | def epoch_limiter(job, num_epochs): |
no test coverage detected