code: def get_optimizer(model, lr):
      param_optimizer = list(model.named_parameters())
      no_decay = ["bias", "gamma", "beta", "LayerNorm"]
  
      # configure the weight decay for bert models
      optimizer_grouped_parameters = [
          {
              "params": [
                  p
                  for n, p in param_optimizer
                  if not any(nd in n for nd in no_decay)
              ],
              "weight_decay": 0.1,
          },
          {
              "params": [
                  p
                  for n, p in param_optimizer
                  if any(nd in n for nd in no_decay)
              ],
              "weight_decay": 0.0,
          },
      ]
      optimizer = HybridAdam(
          optimizer_grouped_parameters, lr=lr, betas=[0.9, 0.95]
      )
      return optimizer
  
file_path: ColossalAI/examples/community/roberta/pretraining/pretrain_utils.py
imports: import os
  import sys
  import torch
  import transformers
  from transformers import get_linear_schedule_with_warmup
  from colossalai.legacy.core import global_context
  from colossalai.nn.optimizer import HybridAdam
  from collections import OrderedDict
  import torch.nn
  from model.bert import BertForMaskedLM
  from model.deberta_v2 import DebertaV2ForMaskedLM
label_desc: Use image node_id 3 for calling a global function with example usage: get_optimizer(model, lr) and returns: optimizer