Пример #1
0
    def load_checkpoint_from_path(checkpoint_file_path: Union[str, Path]) -> Dict:
        """Convenience method to load a checkpoint from path.

        An error will be raised if the provided path does not exist.

        Args:
            checkpoint_file_path (Union[str, Path]): The path to the checkpoint
                to load. If the checkpoint saved in this path has not been
                created by Ray Train, there is no guarantee that it can be
                loaded in successfully.
        """
        return load_checkpoint_from_path(checkpoint_file_path)
Пример #2
0
    def best_checkpoint(self) -> Optional[Dict]:
        """Best saved checkpoint from the latest run.

        "Best" is defined by the input ``CheckpointStrategy``.
        Default behavior is to return the most recent checkpoint.

        Returns ``None`` if ``run()`` has not been called or if
        ``train.save_checkpoint()`` has not been called from ``train_func``
        within the most recent call to ``run``.
        """
        best_checkpoint_path = self.best_checkpoint_path
        if best_checkpoint_path is None:
            return None
        else:
            return load_checkpoint_from_path(best_checkpoint_path)