    def _load_model(self, checkpoint_dir, checkpoint_path=None, resume_type="resume"):
        """Load model from checkpoint. If a folder is given, it will
        load the latest checkpoint in checkpoint_dir. If a path is given
        it will load the checkpoint specified by checkpoint_path.
        **Only use this method after** ``accelerator.prepare()``.
        """
        if checkpoint_path is None or checkpoint_path == "":
            ls = [str(i) for i in Path(checkpoint_dir).glob("*")]
            ls.sort(key=lambda x: int(x.split("_")[-3].split("-")[-1]), reverse=True)
            checkpoint_path = ls[0]
        self.logger.info("Load model from {}".format(checkpoint_path))
        print("Load model from {}".format(checkpoint_path))
        if resume_type == "resume":
            self.accelerator.load_state(checkpoint_path)
            self.epoch = int(checkpoint_path.split("_")[-3].split("-")[-1]) + 1
            self.step = int(checkpoint_path.split("_")[-2].split("-")[-1]) + 1
        elif resume_type == "finetune":
            if isinstance(self.model, dict):
                for idx, sub_model in enumerate(self.model.keys()):
                    if idx == 0:
                        ckpt_name = "pytorch_model.bin"
                    else:
                        ckpt_name = "pytorch_model_{}.bin".format(idx)

                    self.model[sub_model].load_state_dict(
                        torch.load(os.path.join(checkpoint_path, ckpt_name))
                    )
                self.model[sub_model].cuda(self.accelerator.device)
            else:
                self.model.load_state_dict(
                    torch.load(os.path.join(checkpoint_path, "pytorch_model.bin"))
                )
                self.model.cuda(self.accelerator.device)
            self.logger.info("Load model weights for finetune SUCCESS!")

        else:
            raise ValueError("Unsupported resume type: {}".format(resume_type))

        return checkpoint_path
Load model from checkpoint. If a folder is given, it will
load the latest checkpoint in checkpoint_dir. If a path is given
it will load the checkpoint specified by checkpoint_path.
**Only use this method after** ``accelerator.prepare()``.
models/tts/base/tts_trainer.py