code: def get_lightning_trainer(
      config=None,
      model_size=1,
      prepare_trainer=True,
      load_model_from_config=False,
      seed=2,
      **kwargs,
  ):
      torch.random.manual_seed(seed)
      trainer = LightningTrainerMock(config=config, **kwargs)
  
      if not load_model_from_config:
          trainer.model = SimpleLightningModel({"in_dim": model_size})
          trainer.model.build()
          trainer.model.train()
  
          trainer.model.build_meters(trainer.run_type)
          trainer.model.is_pl_enabled = True
      else:
          trainer.load_model()
  
      if prepare_trainer:
          prepare_lightning_trainer(trainer)
  
      return trainer
  
file_path: mmf/tests/trainers/test_utils.py
imports: import os
  import torch
  from mmf.utils.build import build_optimizer
  from mmf.utils.configuration import load_yaml
  from omegaconf import OmegaConf
  from tests.test_utils import SimpleLightningModel, SimpleModel
  from tests.trainers.lightning.lightning_trainer_mock import LightningTrainerMock
  from tests.trainers.test_trainer_mocks import TrainerTrainingLoopMock
label_desc: Use image node_id 6 for calling a global function with example usage: get_lightning_trainer(config, model_size, prepare_trainer, load_model_from_config, seed) and returns: trainer