    def load(self, path: str):
        """
        Load a model from the path.

        Args:
            path (`str`):
                The folder path containing the model's checkpoints.
        """
        state_path = Path(path).joinpath(STATE_CHECKPOINT_NAME)
        model_path = Path(path).joinpath(MODEL_NAME)
        # modelcard_path = Path(path).joinpath(MODEL_CARD_NAME)
        trainer_log.info("Loading from previous checkpoint: %s", model_path)
        state_checkpoint = torch.load(state_path, map_location=self.configs.device)
        model_checkpoint = torch.load(model_path, map_location=self.configs.device)
        self.model.load_state_dict(model_checkpoint)
        if isinstance(self.optimizer, Optimizer) and state_checkpoint["optimizer_state_dict"]:
            self.optimizer.load_state_dict(state_checkpoint["optimizer_state_dict"])
        if self.lr_scheduler and state_checkpoint["lr_scheduler_state_dict"]:
            self.lr_scheduler.load_state_dict(state_checkpoint["lr_scheduler_state_dict"])
        if "end_lr" not in state_checkpoint:
            return 0
        self.lr_value = state_checkpoint["end_lr"]
        if "epoch" not in state_checkpoint:
            return 0
        self.epoch = state_checkpoint["epoch"]
        self.loss_value = state_checkpoint["loss_value"]
        self.metric_value = state_checkpoint["metric_value"]
Load a model from the path.

Args:
path (`str`):
The folder path containing the model's checkpoints.
towhee/trainer/trainer.py