code: def save_model(
      exe, model_dict, args, local_model_path, model_save_path
  ):
      """final save model"""
      mode, model_save_path = parse_path(model_save_path)
      _, working_root = parse_path(args.working_root)
      # multi node
      if paddle.distributed.get_world_size() > 1:
          working_root = os.path.join(working_root, "model")
  
      # save sparse table
      log.info("save sparse table")
      if mode == "hdfs":
          save_pretrained_model(exe, model_save_path, args, mode="hdfs")
      elif mode == "afs":
          save_pretrained_model(
              exe, local_model_path, args, mode="local"
          )
          user, passwd = args.fs_ugi.split(",")
          log.info("being to upload model to: %s " % model_save_path)
          gzshell_upload(
              args.fs_name,
              user,
              passwd,
              local_model_path,
              "afs:%s" % working_root,
          )
          log.info(
              "model has been saved, model_path: %s" % model_save_path
          )
      else:
          save_pretrained_model(
              exe, local_model_path, args, mode="local"
          )
          if paddle.distributed.get_world_size() is 1:
              model_root = working_root
          else:
              model_root = working_root + "/model/"
          if os.path.exists(model_root):
              remove_path(model_root)
          make_dir(working_root)
          tmp_path = os.path.join(working_root, "model")
          if os.path.exists(tmp_path):
              run_cmd("rm -rf %s" % (tmp_path))
          run_cmd("mv %s %s" % (local_model_path, working_root))
          log.info(
              "model has been saved in local path: %s" % working_root
          )
  
      # master node
      if not fleet.worker_index() is 0:
          return
      # save dense model
      log.info("save dense model")
      local_var_save_path = "./dense_vars"
      if os.path.exists(local_var_save_path):
          shutil.rmtree(local_var_save_path)
  
      fluid.io.save_vars(
          exe,
          local_var_save_path,
          model_dict.train_program,
          predicate=name_not_have_sparse,
      )
  
      # local_var_save_path is not existed if no variable in model
      if os.path.exists(local_var_save_path):
          if mode == "hdfs" or mode == "afs":
              HFS.put(local_var_save_path, model_save_path)
          else:
              run_cmd(
                  "mv %s %s" % (local_var_save_path, model_save_path)
              )
  
      return 0
  
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 10 for calling a global function with example usage: save_model(exe, model_dict, args, local_model_path, model_save_path) and returns: int