code: def force_cpu_model(cfg):
      with open_dict(cfg):
          # temporarily set to cpu
          original_cpu_init = cfg.get("use_cpu_initialization", False)
          if "megatron_amp_O2" in cfg:
              amp_o2_key = "megatron_amp_O2"
              original_amp_o2 = cfg.megatron_amp_O2
          elif "megatron_amp_02" in cfg:
              amp_o2_key = "megatron_amp_02"
              original_amp_o2 = cfg.megatron_amp_02
          else:
              amp_o2_key, original_amp_o2 = None, None
  
          # Set new values
          cfg.use_cpu_initialization = True
          if amp_o2_key is not None:
              cfg[amp_o2_key] = False
  
          # Disable sequence parallelism - Not disabling this gives error when converting the the model to TP=1
          original_sequence_parallel = cfg.get(
              "sequence_parallel", None
          )
          cfg.sequence_parallel = False
  
      # Setup restore dict
      restore_dict = {
          "use_cpu_initialization": original_cpu_init
      }  # 'megatron_amp_O2': original_amp_o2
      if amp_o2_key is not None:
          restore_dict[amp_o2_key] = original_amp_o2
      if original_sequence_parallel is not None:
          restore_dict["sequence_parallel"] = original_sequence_parallel
  
      return cfg, restore_dict
  
imports: import os
  import shutil
  import tarfile
  import tempfile
  from argparse import ArgumentParser
  from typing import Dict, List
  import torch
  import torch.nn
  from omegaconf import OmegaConf, open_dict
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.parts.nlp_overrides import NEMO_MEGATRON_MODEL_PARALLEL_APPSTATE_OVERRIDE, GradScaler, MegatronHalfPrecisionPlugin, NLPDDPStrategy, NLPSaveRestoreConnector, PipelineMixedPrecisionPlugin
  from nemo.utils import logging, model_utils
  from nemo.utils.app_state import AppState
label_desc: Use image node_id 2 for calling a global function with example usage: force_cpu_model(cfg) and returns: cfg,  restore_dict