code: def __init__(self, lightning_trainer: Any):
      super().__init__()
      self.lightning_trainer = lightning_trainer
      # this is lightning trainer's config
      self.trainer_config = lightning_trainer.trainer_config
      # training config configures training parameters.
      self.training_config = lightning_trainer.training_config
      self.run_type = lightning_trainer.run_type
  
      # for logging
      self.total_timer = Timer()
      self.snapshot_timer = Timer()
      self.snapshot_iterations = 0
      if self.lightning_trainer.val_loader.has_len():
          self.snapshot_iterations = len(
              self.lightning_trainer.val_loader
          )
      self.train_timer = Timer()
  
imports: import logging
  from typing import Any, Dict, List
  import torch
  from mmf.common.meter import Meter
  from mmf.common.registry import registry
  from mmf.common.report import Report
  from mmf.common.sample import SampleList
  from mmf.utils.logger import calculate_time_left, summarize_report
  from mmf.utils.timer import Timer
  from pytorch_lightning import LightningModule, Trainer
  from pytorch_lightning.callbacks.base import Callback
label_desc: Use image node_id 1 to create a new LightningLoopCallback object from inherited base classes: Callback with example: obj = LightningLoopCallback(lightning_trainer)