def METHOD_NAME(model_cfg, trainer_cfg, precision):
    model_cfg['precision'] = precision
    trainer_cfg['precision'] = precision
    strategy = NLPDDPStrategy()
    trainer = Trainer(strategy=strategy, **trainer_cfg)
    cfg = DictConfig(model_cfg)
    model = MegatronGPTModel(cfg=cfg, trainer=trainer)
    return model