code: def load_pretrained_model(exe, model_dict, args, model_path):
      """load pretrained model"""
      # multi node
      if paddle.distributed.get_world_size() > 1:
          sparse_model_path = os.path.join(
              model_path, "%03d" % (fleet.worker_index())
          )
      else:
          sparse_model_path = model_path
      if os.path.exists(sparse_model_path):  # local directory
          sparse_params_path = os.path.join(sparse_model_path, "000")
          if os.path.exists(sparse_params_path):
              log.info(
                  "[WARM] load sparse model from %s"
                  % sparse_params_path
              )
              if (
                  "train_storage_mode" in args
                  and args.train_storage_mode == "SSD_EMBEDDING"
              ):
                  if (
                      "load_binary_mode" in args
                      and args.load_binary_mode is True
                  ):
                      # in train_storage_mode=SSD_EMBEDDING, mode=0 means load binary batch_model,
                      # mode=4 means save origin batch_model
                      fleet.load_model(sparse_model_path, mode=0)
              else:
                  fleet.load_model(sparse_model_path, mode=0)
              log.info(
                  "[WARM] load sparse model from %s finished."
                  % sparse_params_path
              )
          else:
              raise Exception(
                  "[ERROR] sparse model [%s] is not existed"
                  % sparse_params_path
              )
  
          dense_params_path = os.path.join(model_path, "dense_vars")
  
      else:  # load from hadoop path
          mode, sparse_model_path = parse_path(sparse_model_path)
          sparse_model_path = HFS.check_hadoop_path(sparse_model_path)
          sparse_params_path = os.path.join(sparse_model_path, "000")
  
          if HFS.exists(sparse_params_path):
              log.info(
                  "[WARM] load sparse model from %s"
                  % sparse_params_path
              )
              if (
                  "train_storage_mode" in args
                  and args.train_storage_mode == "SSD_EMBEDDING"
              ):
                  if (
                      "load_binary_mode" in args
                      and args.load_binary_mode is True
                  ):
                      fleet.load_model(sparse_model_path, mode=0)
                  else:
                      fleet.load_model(sparse_model_path, mode=4)
              else:
                  fleet.load_model(sparse_model_path, mode=0)
              log.info(
                  "[WARM] load sparse model from %s finished."
                  % sparse_params_path
              )
          else:
              raise Exception(
                  "[ERROR] sparse model [%s] is not existed"
                  % sparse_params_path
              )
  
          hadoop_dense_params_path = os.path.join(
              model_path, "dense_vars"
          )
          if HFS.exists(hadoop_dense_params_path):
              HFS.get(hadoop_dense_params_path, "./")
          dense_params_path = "./dense_vars"
  
      # load dense vars
      if os.path.exists(dense_params_path):
          log.info(
              "[WARM] load dense parameters from: %s"
              % dense_params_path
          )
          all_vars = model_dict.train_program.global_block().vars
          for filename in os.listdir(dense_params_path):
              if filename in all_vars:
                  log.info("[WARM] var %s existed" % filename)
              else:
                  log.info("[WARM_MISS] var %s not existed" % filename)
  
          fluid.io.load_vars(
              exe,
              dense_params_path,
              model_dict.train_program,
              predicate=name_not_have_sparse,
          )
      else:
          log.info("[WARM] dense model is not existed, skipped")
  
imports: import os
  import sys
  import json
  import time
  import math
  import shutil
  import glob
  import re
  import traceback
  import collections
  import numpy
  import pickle
  from collections import defaultdict, OrderedDict
  from datetime import datetime, timedelta
  import paddle
  import paddle.static
  import paddle.fluid
  import paddle.fluid.core
  import paddle.distributed.fleet
  from pgl.utils.logger import log
  import util_hadoop
label_desc: Use image node_id 6 for calling a global function with example usage: load_pretrained_model(exe, model_dict, args, model_path) without return types