Loads the necessary blobs from the checkpoints. Checkpoints store the snapshots of the workspace in each node. Sometimes we only need to load a subset of the blobs from the checkpoints. One common scenario is to load only the model blobs from the checkpoints for eval
(self, blob_names, epoch, session)
| 759 | return epoch |
| 760 | |
| 761 | def load_blobs_from_checkpoints(self, blob_names, epoch, session): |
| 762 | """Loads the necessary blobs from the checkpoints. |
| 763 | |
| 764 | Checkpoints store the snapshots of the workspace in each node. |
| 765 | Sometimes we only need to load a subset of the blobs from the |
| 766 | checkpoints. One common scenario is to load only the model blobs from |
| 767 | the checkpoints for evaluation purpose. Given the names of the |
| 768 | necessary blobs, this function goes over all the checkpoints of all the |
| 769 | nodes, but only loads the blobs specified in the blob_names to the |
| 770 | current workspace. |
| 771 | |
| 772 | Args: |
| 773 | blob_names: A list of strings. Each string is the name of a |
| 774 | blob. |
| 775 | epoch: An integer. The checkpoint epoch to load from. |
| 776 | session: A Session object to execute the load ops. |
| 777 | |
| 778 | Raises: |
| 779 | ValueError: When the checkpoint manager is invalid. |
| 780 | """ |
| 781 | if not self.checkpoint_manager: |
| 782 | raise ValueError('Checkpoint manager is None') |
| 783 | logger.info('Loading checkpoint for epoch {} ...'.format(epoch)) |
| 784 | result = self.checkpoint_manager.load_blobs_locally( |
| 785 | self.job.nodes_to_checkpoint(), blob_names, epoch, session) |
| 786 | self.checkpoint_manager.report_checkpoint_stats('checkpoint_partial_load') |
| 787 | return result |
| 788 | |
| 789 | def save_checkpoints(self, epoch, session): |
| 790 | """Triggers operation to save checkpoints |