code: def _load_checkpoint_and_test(self, filename, ckpt_config=None):
      # Make sure it loads x.ckpt when mmf
      mmf_ckpt = self._get_mmf_ckpt(filename, ckpt_config=ckpt_config)
  
      # Make sure it loads x.ckpt when lightning
      with mock_env_with_temp(
          "mmf.trainers.lightning_trainer.get_mmf_env"
      ) as tmp_d:
          # generate checkpoint
          lightning_gen = self._get_lightning_trainer(max_steps=6)
          lightning_gen.trainer.fit(
              lightning_gen.model,
              train_dataloaders=lightning_gen.train_loader,
              val_dataloaders=lightning_gen.val_loader,
          )
  
          # load the generated checkpoint, calling fit is necessary to load the
          # checkpoint
          lightning_ckpt = torch.load(os.path.join(tmp_d, filename))
          lightning = self._get_lightning_trainer(
              ckpt_config=ckpt_config,
              model_config={"simple_lightning_model": {"in_dim": 1}},
              max_steps=6,
              seed=4,
          )
          lightning.trainer.fit(
              lightning.model, train_dataloaders=lightning.train_loader
          )
          self._assert_same_dict(
              lightning_ckpt["state_dict"], lightning.model.state_dict()
          )
  
      # Make sure lightning and mmf parity
      self._assert_same_dict(
          mmf_ckpt["model"], lightning_ckpt["state_dict"]
      )
      self.assertEqual(
          mmf_ckpt["current_epoch"], lightning_ckpt["epoch"] + 1
      )
      self.assertEqual(
          mmf_ckpt["num_updates"], lightning_ckpt["global_step"]
      )
      self._assert_same_dict(
          mmf_ckpt["optimizer"], lightning_ckpt["optimizer_states"][0]
      )
  
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 13 for calling the TestLightningCheckpoint obj's underlying member method code with example usage: obj._load_checkpoint_and_test(filename, ckpt_config) without return types