code: def main(cfg) -> None:
      logging.info(
          "\n\n************** Experiment configuration ***********"
      )
      logging.info(f"\n{OmegaConf.to_yaml(cfg)}")
      trainer = MegatronLMPPTrainerBuilder(cfg).create_trainer()
  
      if cfg.model.peft.restore_from_path:
          model_cfg = MegatronGPTSFTModel.merge_inference_cfg(
              cfg.model.peft.restore_from_path, cfg
          )
      else:
          model_cfg = MegatronGPTSFTModel.merge_inference_cfg(
              cfg.model.restore_from_path, cfg
          )
  
      model = MegatronGPTSFTModel.restore_from(
          cfg.model.restore_from_path, model_cfg, trainer=trainer
      )
  
      if cfg.model.peft.restore_from_path:
          model.load_adapters(cfg.model.peft.restore_from_path)
  
      model.freeze()
      logging.info(
          f"Freezing parameters for PEFT eval:\n{model.summarize()}"
      )
  
      if not cfg.model.get("use_flash_attention", False):
          cfg.inference.compute_attention_mask = True
      config = OmegaConf.to_container(cfg.inference, resolve=True)
      model.set_inference_config(config)
  
      if not cfg.server:
          trainer.test(model)
      else:
          use_inference_server(cfg, model, trainer)
  
file_path: NeMo/examples/nlp/language_modeling/tuning/megatron_gpt_peft_eval.py
imports: import asyncio
  import threading
  from functools import partial
  import torch
  import torch.multiprocessing
  from omegaconf.omegaconf import OmegaConf
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_sft_model import MegatronGPTSFTModel
  from nemo.collections.nlp.modules.common.text_generation_server import MegatronServer
  from nemo.collections.nlp.modules.common.text_generation_utils import generate
  from nemo.collections.nlp.parts.megatron_trainer_builder import MegatronLMPPTrainerBuilder
  from nemo.core.config import hydra_runner
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling a global function with example usage: main(cfg) without return types