code: def build_scheduler(args, optimizer, first_optimizer=False):
      """
      Build the scheduler for the conparser based on its args
  
      Used to use a warmup for learning rate, but that wasn't working very well
      Now, we just use a ReduceLROnPlateau, which does quite well
      """
      # if args.get('learning_rate_warmup', 0) <= 0:
      #    # TODO: is there an easier way to make an empty scheduler?
      #    lr_lambda = lambda x: 1.0
      # else:
      #    warmup_end = args['learning_rate_warmup']
      #    def lr_lambda(x):
      #        if x >= warmup_end:
      #            return 1.0
      #        return x / warmup_end
  
      # scheduler = optim.lr_scheduler.LambdaLR(optimizer, lr_lambda)
  
      if first_optimizer:
          scheduler = optim.lr_scheduler.ReduceLROnPlateau(
              optimizer,
              mode="max",
              factor=args["learning_rate_factor"],
              patience=args["learning_rate_patience"],
              cooldown=args["learning_rate_cooldown"],
              min_lr=args["stage1_learning_rate_min_lr"],
          )
      else:
          scheduler = optim.lr_scheduler.ReduceLROnPlateau(
              optimizer,
              mode="max",
              factor=args["learning_rate_factor"],
              patience=args["learning_rate_patience"],
              cooldown=args["learning_rate_cooldown"],
              min_lr=args["learning_rate_min_lr"],
          )
      return scheduler
  
file_path: stanza/stanza/models/constituency/utils.py
imports: from collections import Counter, deque
  import copy
  import logging
  import torch.nn
  from torch import optim
  from stanza.models.common.doc import TEXT, Document
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 6 for calling a global function with example usage: build_scheduler(args, optimizer, first_optimizer) and returns: scheduler