code: def gpt_model(model_cfg, trainer_cfg):
      strategy = NLPDDPStrategy()
      trainer = Trainer(strategy=strategy, **trainer_cfg)
      cfg = DictConfig(model_cfg)
  
      reset_microbatch_calculator()
      model = MegatronGPTModel(cfg, trainer)
  
      return model
  
file_path: NeMo/tests/collections/nlp/test_rampup_batch_size.py
imports: import os
  import pytest
  import torch
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_model import MegatronGPTModel
  from nemo.collections.nlp.parts.nlp_overrides import NLPDDPStrategy
label_desc: Use image node_id 4 for calling a global function with example usage: gpt_model(model_cfg, trainer_cfg) and returns: model