code: def final_save(model, save_dir, tokenizer):
      if not os.path.exists(save_dir):
          os.makedirs(save_dir)
  
      with open(os.path.join(save_dir, "model.yml"), "w") as of:
          of.write(model.disc_cfg.dump())
      tokenizer.vocab.save(os.path.join(save_dir, "vocab.json"))
      model.disc_backbone.save_parameters(
          os.path.join(save_dir, "model.params")
      )
      model.discriminator.save_parameters(
          os.path.join(save_dir, "disc_model.params")
      )
      model.generator.save_parameters(
          os.path.join(save_dir, "gen_model.params")
      )
  
      logging.info("Statistics:")
  
      old_names = os.listdir(save_dir)
      for old_name in old_names:
          new_name, long_hash = naming_convention(save_dir, old_name)
          old_path = os.path.join(save_dir, old_name)
          new_path = os.path.join(save_dir, new_name)
          shutil.move(old_path, new_path)
          file_size = os.path.getsize(new_path)
          logging.info(
              "\t{}/{} {} {}".format(
                  save_dir, new_name, long_hash, file_size
              )
          )
  
imports: import os
  import time
  import shutil
  import logging
  import argparse
  import functools
  import collections
  import mxnet
  import numpy
  from mxnet.lr_scheduler import PolyScheduler
  from sklearn import metrics
  from pretraining_utils import ElectraMasker, get_pretrain_data_npz, get_pretrain_data_text, get_electra_pretraining_model
  from gluonnlp.utils.misc import repeat, grouper, set_seed, init_comm, logging_config, naming_convention
  from gluonnlp.models.electra import ElectraModel, ElectraForPretrain
  from gluonnlp.utils.parameter import clip_grad_global_norm
label_desc: Use image node_id 2 for calling a global function with example usage: final_save(model, save_dir, tokenizer) without return types