code: def validate_checkpoint_loading_args(cfg):
      if cfg.checkpoint_dir is None or not os.path.isdir(
          cfg.checkpoint_dir
      ):
          raise ValueError(
              f"Checkpoint directory {cfg.checkpoint_dir} does not exist or is not a directory."
          )
      if cfg.checkpoint_name is None:
          raise ValueError(
              f"Checkpoint name {cfg.checkpoint_name} is not valid."
          )
      if cfg.hparams_file is None or not os.path.isfile(
          cfg.hparams_file
      ):
          raise ValueError(
              f"Hparams file {cfg.hparams_file} does not exist or is not a file."
          )
  
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 4 for calling a global function with example usage: validate_checkpoint_loading_args(cfg) without return types