code: def build_adamwdl(
      model,
      lr=1e-4,
      weight_decay=0.05,
      betas=(0.9, 0.999),
      layer_decay=0.65,
      num_layers=None,
      filter_bias_and_bn=True,
      skip_decay_names=None,
      set_param_lr_func="layerwise_lr_decay",
  ):
      if skip_decay_names and filter_bias_and_bn:
          decay_dict = {
              param.name: not (
                  len(param.shape) == 1
                  or name.endswith(".bias")
                  or any([_n in name for _n in skip_decay_names])
              )
              for name, param in model.named_parameters()
          }
          parameters = [p for p in model.parameters()]
  
      else:
          parameters = model.parameters()
  
      opt_args = dict(
          parameters=parameters,
          learning_rate=lr,
          weight_decay=weight_decay,
      )
  
      if decay_dict is not None:
          opt_args["apply_decay_param_fun"] = lambda n: decay_dict[n]
  
      if isinstance(set_param_lr_func, str):
          set_param_lr_func = eval(set_param_lr_func)
          opt_args["set_param_lr_func"] = set_param_lr_func
  
      opt_args["beta1"] = betas[0]
      opt_args["beta2"] = betas[1]
  
      opt_args["layerwise_decay"] = layer_decay
      name_dict = {p.name: n for n, p in model.named_parameters()}
  
      opt_args["name_dict"] = name_dict
      opt_args["n_layers"] = num_layers
  
      optimizer = AdamWDL(**opt_args)
  
      return optimizer
  
file_path: PaddleDetection/ppdet/optimizer/adamw.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  from paddle.optimizer import AdamW
  from functools import partial
  import re
label_desc: Use image node_id 3 for calling a global function with example usage: build_adamwdl(model, lr, weight_decay, betas, layer_decay, num_layers, filter_bias_and_bn, skip_decay_names, set_param_lr_func) and returns: optimizer