docstr: Utility method that must be explicitly called by the subclass in order to support optional optimization flags.
  This method is the only valid place to access self.cfg prior to DDP training occurs.
  
  The subclass may chose not to support this method, therefore all variables here must be checked via hasattr()
docstr_tok: ["Utility","method","that","must","be","explicitly","called","by","the","subclass","in","order","to","support","optional","optimization","flags",".","This","method","is","the","only","valid","place","to","access","self.cfg","prior","to","DDP","training","occurs",".","The","subclass","may","chose","not","to","support","this","method",",","therefore","all","variables","here","must","be","checked","via","hasattr","(",")"]
code: def setup_optimization_flags(self):
      """
      Utility method that must be explicitly called by the subclass in order to support optional optimization flags.
      This method is the only valid place to access self.cfg prior to DDP training occurs.
  
      The subclass may chose not to support this method, therefore all variables here must be checked via hasattr()
      """
      # Skip update if nan/inf grads appear on any rank.
      self._skip_nan_grad = False
      if "skip_nan_grad" in self._cfg and self._cfg["skip_nan_grad"]:
          self._skip_nan_grad = self._cfg["skip_nan_grad"]
  
imports: import logging
  from abc import ABC, abstractmethod
  from typing import List
  import torch
  from nemo.core.classes import ModelPT
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.core.classes.exportable import Exportable
  from nemo.core.classes.mixins import AccessMixin
  from nemo.core.utils.neural_type_utils import get_io_names
  from nemo.utils import logging, model_utils
  from nemo.utils.cast_utils import cast_all
label_desc: Use image node_id 6 for calling the ASRModel obj's underlying member method code with example usage: obj.setup_optimization_flags() without return types