def METHOD_NAME(
    self,
    config: Coqpit,
    checkpoint_path: str,
    eval: bool = False,
    use_cuda: bool = False,
    criterion=None,
    cache=False,
):
    state = load_fsspec(checkpoint_path, map_location=torch.device("cpu"), cache=cache)
    try:
        self.load_state_dict(state["model"])
        print(" > Model fully restored. ")
    except (KeyError, RuntimeError) as error:
        # If eval raise the error
        if eval:
            raise error
        print(" > Partial model initialization.")
        model_dict = self.state_dict()
        model_dict = set_init_dict(model_dict, state["model"], c)
        self.load_state_dict(model_dict)
        del model_dict
    # load the criterion for restore_path
    if criterion is not None and "criterion" in state:
        try:
            criterion.load_state_dict(state["criterion"])
        except (KeyError, RuntimeError) as error:
            print(" > Criterion load ignored because of:", error)
    # instance and load the criterion for the encoder classifier in inference time
    if (
        eval
        and criterion is None
        and "criterion" in state
        and getattr(config, "map_classid_to_classname", None) is not None
    ):
        criterion = self.get_criterion(config, len(config.map_classid_to_classname))
        criterion.load_state_dict(state["criterion"])
    if use_cuda:
        self.cuda()
        if criterion is not None:
            criterion = criterion.cuda()
    if eval:
        self.eval()
        assert not self.training
    if not eval:
        return criterion, state["step"]
    return criterion