import torch


def get_scheduler(optimizer, config):
    """
    Creates the scheduler from the config
    """
    if config["name"] == "cosine":
        scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=config["T_max"])
        return scheduler
    else:
        raise NotImplementedError