code: def test_load_mmf_trainer_checkpoint_in_lightning(self):
      # specifying an mmf .ckpt as the trainer resume_from_checkpoint
      # for lightning trainer
      with mock_env_with_temp(
          "mmf.utils.checkpoint.get_mmf_env"
      ) as tmp_d, mock_env_with_temp(
          "mmf.common.test_reporter.get_mmf_env"
      ) as _:
          # generate checkpoint
          self._get_mmf_trainer(max_updates=6).training_loop()
  
          # load the trianer checkpoint that is of mmf type
          ckpt_file = os.path.join(tmp_d, "current.ckpt")
          ckpt = torch.load(ckpt_file, map_location="cpu")
  
          with patch.object(
              LightningLoopCallback,
              "on_train_batch_end",
              return_value=None,
          ) as mock_method:
              lightning = self._get_lightning_trainer(
                  max_steps=6,
                  resume_from_checkpoint=ckpt_file,
                  model_config={
                      "simple_lightning_model": {"in_dim": 1}
                  },
              )
              lightning.trainer.fit(
                  lightning.model,
                  train_dataloaders=lightning.train_loader,
              )
              self.assertEqual(lightning.trainer.global_step, 6)
              call_args_list = mock_method.call_args_list
              # training will take place 0 times. Since max_steps is the same
              # as the checkpoint's global_step
              self.assertEqual(len(call_args_list), 0)
  
              # check to make sure that the lightning trainer's model and
              # mmf's are the same
              lightning_ckpt = lightning.trainer.model.state_dict()
              self.assertDictEqual(lightning_ckpt, ckpt["model"])
  
imports: import contextlib
  import os
  import tempfile
  import unittest
  from unittest.mock import patch
  import torch
  from mmf.trainers.callbacks.checkpoint import CheckpointCallback
  from mmf.trainers.callbacks.early_stopping import EarlyStoppingCallback
  from mmf.trainers.lightning_core.loop_callback import LightningLoopCallback
  from mmf.utils.checkpoint import get_ckpt_path_from_folder
  from mmf.utils.download import download_pretrained_model
  from tests.test_utils import skip_if_no_network
  from tests.trainers.test_utils import get_config_with_defaults, get_lightning_trainer, get_mmf_trainer, prepare_lightning_trainer
label_desc: Use image node_id 6 for calling the TestLightningCheckpoint obj's underlying member method code with example usage: obj.test_load_mmf_trainer_checkpoint_in_lightning() without return types