code: def load_checkpoint(args, model):
      global global_step
      global global_data_samples
      global last_global_step_from_restore
  
      config = args.config
      logger = args.logger
  
      logger.info(
          f"Restoring previous training checkpoint from PATH={args.load_training_checkpoint}, CKPT_ID={args.load_checkpoint_id}"
      )
      (
          start_epoch,
          global_step,
          global_data_samples,
      ) = load_training_checkpoint(
          args=args,
          model=model,
          PATH=args.load_training_checkpoint,
          ckpt_id=args.load_checkpoint_id,
      )
      logger.info(
          f"The model is loaded from last checkpoint at epoch {start_epoch} when the global steps were at {global_step} and global data samples at {global_data_samples}"
      )
  
      if args.rewarmup:
          logger.info(
              f"Rewarmup learning rate with last_global_step_from_restore = {global_step}"
          )
          last_global_step_from_restore = global_step
  
      lr_this_step = config["training"][
          "learning_rate"
      ] * warmup_linear_decay_exp(
          global_step,
          config["training"]["decay_rate"],
          config["training"]["decay_step"],
          config["training"]["total_training_steps"],
          config["training"]["warmup_proportion"],
      )
      logger.info(f"Restart training with lr = {lr_this_step}")
  
      # Run validation for checkpoint before training
      if not args.finetune and args.max_seq_length == 512:
          logger.info(
              f"Validation Loss of Checkpoint {start_epoch} before pretraining"
          )
          index = start_epoch - 1 if start_epoch > 0 else start_epoch
          pretrain_validation(args, index, model)
  
      return start_epoch
  
imports: import os
  import sys
  import time
  import logging
  import numpy
  import random
  import json
  import torch
  import torch.distributed
  from torch.utils.data import DataLoader, Dataset
  from torch.utils.data.sampler import RandomSampler, SequentialSampler
  from torch.utils.data.distributed import DistributedSampler
  from tqdm import tqdm
  from turing.logger import Logger
  from turing.utils import get_sample_writer
  from turing.models import BertMultiTask
  from turing.dataset import PreTrainingDataset, PretrainBatch, PretrainDataType
  from turing.sources import PretrainingDataCreator, WikiPretrainingDataCreator, TokenInstance
  from pytorch_pretrained_bert.tokenization import BertTokenizer
  from pytorch_pretrained_bert.optimization import BertAdam, warmup_linear, warmup_linear_decay_exp, warmup_exp_decay_exp, warmup_exp_decay_poly
  from utils import get_argument_parser, is_time_to_exit
  from bing_bert_dataset_provider import BingBertDatasetProvider
  from nvidia_bert_dataset_provider import NvidiaBertDatasetProvider
  import deepspeed
  from deepspeed.utils.logging import logger
label_desc: Use image node_id 14 for calling a global function with example usage: load_checkpoint(args, model) and returns: start_epoch