def METHOD_NAME(cfg: DictConfig, restore: bool):
    """
    Loads encoder model.
    Args:
        cfg: Config file specifying model parameters
        restore: Whether to restore model weights trained
                 by the user. Otherwise will load weights
                 used before self alignment pretraining. 
    """
    if restore:
        model = EntityLinkingModel.restore_from(cfg.nemo_path)
    else:
        cfg.train_ds = None
        cfg.validation_ds = None
        cfg.test_ds = None
        model = EntityLinkingModel(cfg)
    model = model.to(device)
    return model