class_docstr: Callback for Early Stopping mechanism and checks if it training
  should continue or stop.
docstr: Attr:
      config(mmf_typings.DictConfig): Config for the callback
      trainer(Type[BaseTrainer]): Trainer object
docstr_tok: ["Attr",":","config","(","mmf_typings.DictConfig",")",":","Config","for","the","callback","trainer","(","Type","[","BaseTrainer","]",")",":","Trainer","object"]
code: def __init__(self, config, trainer):
      """
      Attr:
          config(mmf_typings.DictConfig): Config for the callback
          trainer(Type[BaseTrainer]): Trainer object
      """
      super().__init__(config, trainer)
  
      early_stop_criteria = self.training_config.early_stop.criteria
      early_stop_minimize = self.training_config.early_stop.minimize
      early_stop_enabled = self.training_config.early_stop.enabled
      early_stop_patience = self.training_config.early_stop.patience
      self.early_stopping = EarlyStopping(
          self.trainer.model,
          self.trainer.checkpoint_callback.checkpoint,
          early_stop_criteria,
          patience=early_stop_patience,
          minimize=early_stop_minimize,
          should_stop=early_stop_enabled,
      )
  
imports: from mmf.trainers.callbacks.base import Callback
  from mmf.utils.checkpoint import consolidate_optim_state_dict
  from mmf.utils.distributed import broadcast_scalar
  from mmf.utils.early_stopping import EarlyStopping
label_desc: Use image node_id 1 to create a new EarlyStoppingCallback object from inherited base classes: Callback with example: obj = EarlyStoppingCallback(config, trainer)