code: def load_from_nemo(cls, cfg, trainer, gpt_cfg, modify_confg_fn):
      gpt_cfg = modify_confg_fn(gpt_cfg, cfg, add_cfg_to_tree=False)
      save_restore_connector = NLPSaveRestoreConnector()
      if os.path.isdir(cfg.model.restore_from_path):
          save_restore_connector.model_extracted_dir = (
              cfg.model.restore_from_path
          )
      model = cls.restore_from(
          restore_path=cfg.model.restore_from_path,
          trainer=trainer,
          override_config_path=gpt_cfg,
          save_restore_connector=save_restore_connector,
      )
      return model
  
file_path: NeMo/examples/nlp/language_modeling/tuning/megatron_gpt_sft.py
imports: import os
  import tempfile
  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.data.language_modeling.megatron.gpt_sft_chat_dataset import get_prompt_template_example
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_sft_model import MegatronGPTSFTModel
  from nemo.collections.nlp.modules.common.megatron.megatron_init import fake_initialize_model_parallel
  from nemo.collections.nlp.parts.nlp_overrides import CustomProgressBar, GradScaler, MegatronHalfPrecisionPlugin, NLPDDPStrategy, NLPSaveRestoreConnector, PipelineMixedPrecisionPlugin
  from nemo.core.config import hydra_runner
  from nemo.utils import AppState, logging
  from nemo.utils.decorators import deprecated
  from nemo.utils.exp_manager import exp_manager
  from nemo.utils.model_utils import inject_model_parallel_rank
label_desc: Use image node_id 2 for calling a global function with example usage: load_from_nemo(cls, cfg, trainer, gpt_cfg, modify_confg_fn) and returns: model