docstr: Prepare optimizer and schedule (linear warmup and decay)
docstr_tok: ["Prepare","optimizer","and","schedule","(","linear","warmup","and","decay",")"]
code: def configure_optimizers(self):
      """Prepare optimizer and schedule (linear warmup and decay)"""
      model = self.model
      no_decay = ["bias", "LayerNorm.weight"]
      optimizer_grouped_parameters = [
          {
              "params": [
                  p
                  for n, p in model.named_parameters()
                  if not any(nd in n for nd in no_decay)
              ],
              "weight_decay": self.hparams.weight_decay,
          },
          {
              "params": [
                  p
                  for n, p in model.named_parameters()
                  if any(nd in n for nd in no_decay)
              ],
              "weight_decay": 0.0,
          },
      ]
      if self.hparams.adafactor:
          optimizer = Adafactor(
              optimizer_grouped_parameters,
              lr=self.hparams.learning_rate,
              scale_parameter=False,
              relative_step=False,
          )
  
      else:
          optimizer = AdamW(
              optimizer_grouped_parameters,
              lr=self.hparams.learning_rate,
              eps=self.hparams.adam_epsilon,
          )
      self.opt = optimizer
  
      scheduler = self.get_lr_scheduler()
  
      return [optimizer], [scheduler]
  
imports: import argparse
  import logging
  import os
  from pathlib import Path
  from typing import Any, Dict
  import pytorch_lightning
  from pytorch_lightning.utilities import rank_zero_info
  from transformers import AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoModelForQuestionAnswering, AutoModelForSeq2SeqLM, AutoModelForSequenceClassification, AutoModelForTokenClassification, AutoModelWithLMHead, AutoTokenizer, PretrainedConfig, PreTrainedTokenizer
  from transformers.optimization import Adafactor, get_cosine_schedule_with_warmup, get_cosine_with_hard_restarts_schedule_with_warmup, get_linear_schedule_with_warmup, get_polynomial_decay_schedule_with_warmup
  from transformers.utils.versions import require_version
label_desc: Use image node_id 4 for calling the BaseTransformer obj's underlying member method code with example usage: obj.configure_optimizers() and returns: list,  list