import torch


def get_optim_scheduler(cfg, params):
    """ configure optim and scheduler """
    optim = torch.optim.Adam([{'params': params[0], 'weight_decay': cfg.weight_decay},
                              {'params': params[1], 'weight_decay': 0}], lr=cfg.learning_rate)
    scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optim, "min", 0.2, 5)

    return optim, scheduler