def METHOD_NAME(self, dy_model, config):
    lr = config.get("hyper_parameters.optimizer.learning_rate", 0.001)
    opt = config.get("hyper_parameters.optimizer.class", 'Adam')
    if opt == 'Adagrad':
        optimizer = paddle.optimizer.Adagrad(
            learning_rate=lr,
            parameters=dy_model.parameters(),
            weight_decay=None)
    elif opt == 'AdamW':
        optimizer = paddle.optimizer.AdamW(
            learning_rate=lr,
            parameters=dy_model.parameters(),
            weight_decay=None)
    else:
        optimizer = paddle.optimizer.Adam(
            learning_rate=lr,
            parameters=dy_model.parameters(),
            weight_decay=None)  # 2e-6
    return optimizer