code: def load_model(cls, checkpoint, strict, **kwargs):
      try:
          if "cfg" in kwargs:
              model = ptl_load_state(
                  cls, checkpoint, strict=strict, **kwargs
              )
          else:
              model = ptl_load_state(
                  cls,
                  checkpoint,
                  strict=strict,
                  cfg=checkpoint[cls.CHECKPOINT_HYPER_PARAMS_KEY].cfg,
                  **kwargs,
              )
              # register the artifacts
              cfg = checkpoint[cls.CHECKPOINT_HYPER_PARAMS_KEY].cfg
              if cfg.tokenizer.model is not None:
                  model.register_artifact(
                      "tokenizer.tokenizer_model", cfg.tokenizer.model
                  )
              if cfg.tokenizer.vocab_file is not None:
                  model.register_artifact(
                      "tokenizer.vocab_file", cfg.tokenizer.vocab_file
                  )
              if cfg.tokenizer.merge_file is not None:
                  model.register_artifact(
                      "tokenizer.merge_file", cfg.tokenizer.merge_file
                  )
      finally:
          cls._set_model_restore_state(is_being_restored=False)
      return model
  
imports: import importlib
  import os
  import pathlib
  import sys
  from argparse import ArgumentParser
  from collections import OrderedDict
  from typing import Any, Optional
  import torch
  from lightning_fabric.utilities.cloud_io import _load
  from megatron.core import parallel_state
  from pytorch_lightning.core.saving import _load_state
  from pytorch_lightning.core.saving import load_hparams_from_tags_csv, load_hparams_from_yaml
  from pytorch_lightning.trainer.trainer import Trainer
  from pytorch_lightning.utilities.migration import pl_legacy_patch
  from nemo.collections.nlp.models.language_modeling.megatron_bert_model import MegatronBertModel
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_model import MegatronGPTModel
  from nemo.collections.nlp.modules.common.megatron.megatron_init import initialize_model_parallel_for_nemo
  from nemo.collections.nlp.parts.nlp_overrides import NLPSaveRestoreConnector
  from nemo.utils import AppState, logging
  from nemo.utils.distributed import initialize_distributed
  from nemo.utils.model_utils import inject_model_parallel_rank, uninject_model_parallel_rank
label_desc: Use image node_id 5 for calling a global function with example usage: load_model(cls, checkpoint, strict) and returns: model