code: def main(cfg: MTEncDecConfig) -> None:
      # merge default config with user specified config
      default_cfg = MTEncDecConfig()
      cfg = update_model_config(default_cfg, cfg)
      logging.info(
          "\n\n************** Experiment configuration ***********"
      )
      logging.info(f"Config: {OmegaConf.to_yaml(cfg)}")
  
      # training is managed by PyTorch Lightning
      trainer_cfg = OmegaConf.to_container(cfg.trainer)
      trainer_cfg.pop("strategy", None)
      trainer = Trainer(strategy=NLPDDPStrategy(), **trainer_cfg)
  
      # tokenizers will be trained and and tarred training data will be created if needed
      # model config is then updated
      if cfg.model.preproc_out_dir is not None:
          MTDataPreproc(cfg=cfg.model, trainer=trainer)
  
      # experiment logs, checkpoints, and auto-resume are managed by exp_manager and PyTorch Lightning
      exp_manager(trainer, cfg.exp_manager)
  
      # everything needed to train translation models is encapsulated in the NeMo MTEncdDecModel
      mt_model = MTEncDecModel(cfg.model, trainer=trainer)
  
      logging.info(
          "\n\n************** Model parameters and their sizes ***********"
      )
      for name, param in mt_model.named_parameters():
          print(name, param.size())
      logging.info(
          "***********************************************************\n\n"
      )
  
      if cfg.do_training:
          trainer.fit(mt_model)
      # Reset for PTL 2.0 as test uses the same ckpt as train via previously set self._ckpt_path
      trainer.ckpt_path = None
      if cfg.do_testing:
          trainer.test(mt_model)
  
file_path: NeMo/examples/nlp/machine_translation/enc_dec_nmt.py
imports: from dataclasses import dataclass
  from typing import Optional
  from omegaconf import OmegaConf
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.data.machine_translation.preproc_mt_data import MTDataPreproc
  from nemo.collections.nlp.models.machine_translation.mt_enc_dec_config import MTEncDecModelConfig
  from nemo.collections.nlp.models.machine_translation.mt_enc_dec_model import MTEncDecModel
  from nemo.collections.nlp.parts.nlp_overrides import NLPDDPStrategy
  from nemo.core.config import hydra_runner
  from nemo.core.config.modelPT import NemoConfig
  from nemo.core.config.pytorch_lightning import TrainerConfig
  from nemo.utils import logging
  from nemo.utils.config_utils import update_model_config
  from nemo.utils.exp_manager import ExpManagerConfig, exp_manager
label_desc: Use image node_id 1 for calling a global function with example usage: main(cfg) without return types