code: def main(cfg) -> None:
      logging.info(
          "\n\n************** Experiment configuration ***********"
      )
      logging.info(f"\n{OmegaConf.to_yaml(cfg)}")
  
      plugins = []
      strategy = NLPDDPStrategy(
          no_ddp_communication_hook=True,
          find_unused_parameters=False,
      )
      if (
          cfg.trainer.precision == 16
          or cfg.trainer.precision == "16-mixed"
      ):
          scaler = GradScaler(
              init_scale=cfg.model.get(
                  "native_amp_init_scale", 2**32
              ),
              growth_interval=cfg.model.get(
                  "native_amp_growth_interval", 1000
              ),
              hysteresis=cfg.model.get("hysteresis", 2),
              enabled=False
              if cfg.model.pipeline_model_parallel_size > 1
              else True,  # turn off the grad scale for pipeline parallel LM model
          )
          # MixedPrecisionPlugin in PTL >= 2.0 requires precision to be 16-mixed or bf16-mixed
          plugins.append(
              PipelineMixedPrecisionPlugin(
                  precision="16-mixed", device="cuda", scaler=scaler
              )
          )
  
      if cfg.get("cluster_type", None) == "BCP":
          plugins.append(TorchElasticEnvironment())
  
      trainer = Trainer(
          plugins=plugins,
          strategy=strategy,
          **cfg.trainer,
          callbacks=[CustomProgressBar()],
      )
      exp_manager(trainer, cfg.exp_manager)
  
      # load existing or init new soft prompt T5 model
      if cfg.model.get("restore_path", None):
          model = MegatronT5PromptLearningModel.restore_from(
              cfg.model.restore_path,
              cfg.model,
              trainer=trainer,
              save_restore_connector=NLPSaveRestoreConnector(),
          )
  
      else:
          model = MegatronT5PromptLearningModel(
              cfg.model, trainer=trainer
          )
  
      trainer.fit(model)
  
file_path: NeMo/examples/nlp/language_modeling/megatron_t5_prompt_learning.py
imports: import torch.multiprocessing
  from omegaconf.omegaconf import OmegaConf, open_dict
  from pytorch_lightning import Trainer
  from pytorch_lightning.plugins.environments import TorchElasticEnvironment
  from nemo.collections.nlp.models.language_modeling.megatron_t5_prompt_learning_model import MegatronT5PromptLearningModel
  from nemo.collections.nlp.parts.nlp_overrides import CustomProgressBar, GradScaler, NLPDDPStrategy, NLPSaveRestoreConnector, PipelineMixedPrecisionPlugin
  from nemo.core.config import hydra_runner
  from nemo.utils import logging
  from nemo.utils.decorators import deprecated
  from nemo.utils.exp_manager import exp_manager
label_desc: Use image node_id 1 for calling a global function with example usage: main(cfg) without return types