docstr: Return a kwarg dictionary that will be used to override optimizer
  args stored in checkpoints. This allows us to load a checkpoint and
  resume training using a different set of optimizer args, e.g., with a
  different learning rate.
docstr_tok: ["Return","a","kwarg","dictionary","that","will","be","used","to","override","optimizer","args","stored","in","checkpoints",".","This","allows","us","to","load","a","checkpoint","and","resume","training","using","a","different","set","of","optimizer","args",",","e.g.",",","with","a","different","learning","rate","."]
code: def optimizer_config(self):
      """
      Return a kwarg dictionary that will be used to override optimizer
      args stored in checkpoints. This allows us to load a checkpoint and
      resume training using a different set of optimizer args, e.g., with a
      different learning rate.
      """
      return {
          "lr": self.cfg.lr[0]
          if isinstance(self.cfg.lr, Collection)
          else self.cfg.lr,
          "momentum": self.cfg.momentum,
          "weight_decay": self.cfg.weight_decay,
      }
  
file_path: fairseq/fairseq/optim/nag.py
imports: from collections.abc import Collection
  from dataclasses import dataclass, field
  from typing import List
  import torch
  from fairseq.dataclass import FairseqDataclass
  from omegaconf import II, DictConfig
  from torch.optim.optimizer import Optimizer, required
  from .None import FairseqOptimizer, register_optimizer
label_desc: Use image node_id 2 for calling the FairseqNAG obj's underlying member method code with example usage: obj.optimizer_config() and returns: dict