code: def get_optimizer(
      optimizer_name,
      learning_rate,
      b1,
      b2,
      epsilon,
      l2_reg,
      vector_l2,
      accumulate_steps,
      mixed_precision,
      acc_grads_on_cpu,
  ):
      Optimizer = OPTIMIZERS.get(optimizer_name, None)
      if Optimizer is None:
          raise FinetuneError(
              "Optimizer must be in {}, not {}".format(
                  list(OPTIMIZERS.keys()), optimizer_name
              )
          )
  
      if accumulate_steps > 1:
          Optimizer = get_grad_accumulation_optimizer(
              Optimizer,
              accumulate_steps,
              accumulate_on_cpu=acc_grads_on_cpu,
          )
  
      decay_var_list = [
          v
          for v in tf.compat.v1.global_variables()
          if (len(v.get_shape()) > 1 or vector_l2)
          and "Transition_matrix" not in v.name
      ]
  
      opt = Optimizer(
          learning_rate=learning_rate,
          beta1=b1,
          beta2=b2,
          epsilon=epsilon,
          weight_decay=l2_reg * learning_rate,
          decay_var_list=decay_var_list,
      )
  
      if mixed_precision:
          opt = tf.compat.v1.train.experimental.MixedPrecisionLossScaleOptimizer(
              # Default is 2k which is too high for some of our small datasets. May be sitting at underflowing gradients for large amounts of training.
              opt,
              tf.compat.v1.train.experimental.DynamicLossScale(
                  increment_period=100
              ),
          )
      return opt
  
file_path: finetune/finetune/util/optimize_loss.py
imports: import logging
  import tensorflow
  from finetune.optimizers.adafactor import AdafactorOptimizer
  from finetune.optimizers.gradient_accumulation import get_grad_accumulation_optimizer
  from finetune.optimizers.learning_rate_schedules import schedules
  from finetune.optimizers.weight_decay import AdamW
label_desc: Use image node_id 2 for calling a global function with example usage: get_optimizer(optimizer_name, learning_rate, b1, b2, epsilon, l2_reg, vector_l2, accumulate_steps, mixed_precision, acc_grads_on_cpu) and returns: opt