code: def test_validation(self, log_dir, mkdirs):
      config = self._get_config(
          max_steps=8,
          batch_size=2,
          val_check_interval=3,
          log_every_n_steps=9,  # turn it off
          limit_val_batches=1.0,
      )
      trainer = get_lightning_trainer(
          config=config, prepare_trainer=False
      )
      callback = LightningLoopCallback(trainer)
      trainer.callbacks.append(callback)
      lightning_values = []
  
      def log_values(
          current_iteration: int,
          num_updates: int,
          max_updates: int,
          meter: Meter,
          extra: Dict[str, Any],
          tb_writer: TensorboardLogger,
      ):
          lightning_values.append(
              {
                  "current_iteration": current_iteration,
                  "num_updates": num_updates,
                  "max_updates": max_updates,
                  "avg_loss": meter.loss.avg,
              }
          )
  
      with patch(
          "mmf.trainers.lightning_core.loop_callback.summarize_report",
          side_effect=log_values,
      ):
          run_lightning_trainer(trainer)
  
      self.assertEqual(len(self.ground_truths), len(lightning_values))
      for gt, lv in zip(self.ground_truths, lightning_values):
          keys = list(gt.keys())
          self.assertListEqual(keys, list(lv.keys()))
          for key in keys:
              self.assertAlmostEqual(gt[key], lv[key], 1)
  
imports: import gc
  import unittest
  from typing import Any, Dict, Optional
  from unittest.mock import MagicMock, patch
  from mmf.common.meter import Meter
  from mmf.trainers.callbacks.logistics import LogisticsCallback
  from mmf.trainers.lightning_core.loop_callback import LightningLoopCallback
  from mmf.trainers.lightning_core.loop_callback_with_torchmetrics import LightningTorchMetricsCallback
  from mmf.trainers.lightning_core.torchmetric import LightningTorchMetrics
  from mmf.utils.logger import TensorboardLogger
  from mmf.utils.timer import Timer
  from tests.trainers.test_utils import get_config_with_defaults, get_lightning_trainer, get_mmf_trainer, run_lightning_trainer
label_desc: Use image node_id 3 for calling the TestLightningTrainerValidation obj's underlying member method code with example usage: obj.test_validation(log_dir, mkdirs) without return types