def _restore(self, ckpt_file, check_ckpt_exists):
        """
        helper to be used in self.restore() and self.restore_full_name()
        Returns:
            - ckpt file name if successfully restored
            - None otherwise
        """
        ckpt_path = self._get_path(ckpt_file)
        if not U.f_exists(ckpt_path):
            if check_ckpt_exists:
                raise FileNotFoundError(ckpt_path + ' missing.')
            else:
                return None
        # overwrite attributes on self.tracked_obj
        with open(ckpt_path, 'rb') as fp:
            data = pickle.load(fp)
        for attr_name in self.metadata.tracked_attrs:
            attr_value = getattr(self.tracked_obj, attr_name)
            if isinstance(attr_value, (torch.nn.Module, torch.optim.Optimizer)):
                attr_value.load_state_dict(data[attr_name])
            else:
                setattr(self.tracked_obj, attr_name, data[attr_name])
        return ckpt_path

        helper to be used in self.restore() and self.restore_full_name()
        Returns:
            - ckpt file name if successfully restored
            - None otherwise
        
surreal/utils/checkpoint.py