code: def save_clean_best_model(
      args,
      print_rank_0,
      model,
      tokenizer,
      config,
      redundancy_clean,
      eval_dataloader,
      mm_eval_dataloader,
      device,
      is_regression,
      previous_best,
      best_dev_acc,
      ds_config=None,
  ):
      if ds_config is not None:
          WEIGHTS_NAME = "pytorch_model.bin"
          CONFIG_NAME = "config.json"
          (
              layer_reduction_enabled,
              prune_enabled,
              quantization_enabled,
          ) = check_and_identify_compresssion(args, ds_config)
          output_dir_best = os.path.join(args.output_dir, "best")
          best_model_path = os.path.join(output_dir_best, WEIGHTS_NAME)
          if os.path.exists(output_dir_best):
              best_model = torch.load(best_model_path)
              new_sd = {}
              for k, v in best_model.items():
                  new_sd["module." + k] = v
              model.load_state_dict(new_sd, strict=False)
          else:
              print_rank_0("WARNING: no best model yet")
  
          result = do_eval(
              args,
              model,
              eval_dataloader,
              mm_eval_dataloader,
              device,
              is_regression=is_regression,
          )
          (
              current_result,
              previous_best,
              best_dev_acc,
              _,
          ) = arrange_output(
              args.task_name, result, previous_best, best_dev_acc
          )
          print_rank_0(
              f"Before clean, double check the perforamnce of best model is {current_result}"
          )
          try:
              model = redundancy_clean(model, args.deepspeed_config)
          except:
              print_rank_0("WARNING: redundany_clean is not applicable")
              pass
  
          if ds_config["compression_training"]["head_pruning"][
              "shared_parameters"
          ]["enabled"]:
              for module in model.modules():
                  if hasattr(module, "num_attention_heads"):
                      ratio = ds_config["compression_training"][
                          "head_pruning"
                      ]["different_groups"]["rp1"]["params"][
                          "dense_ratio"
                      ]
                      config.num_attention_heads = math.ceil(
                          config.num_attention_heads * ratio
                      )
                      module.num_attention_heads = math.ceil(
                          module.num_attention_heads * ratio
                      )
                      module.all_head_size = int(
                          module.num_attention_heads * 64
                      )
  
          result = do_eval(
              args,
              model,
              eval_dataloader,
              mm_eval_dataloader,
              device,
              is_regression=is_regression,
          )
          (
              current_result,
              previous_best,
              best_dev_acc,
              _,
          ) = arrange_output(
              args.task_name, result, previous_best, best_dev_acc
          )
          print_rank_0(
              f"Clean the best model, and the accuracy of the clean model is {current_result}"
          )
  
          model_to_save = (
              model.module if hasattr(model, "module") else model
          )
          model_to_save = copy.deepcopy(model_to_save)
          WEIGHTS_NAME = "pytorch_model.bin"
          CONFIG_NAME = "config.json"
  
          if args.local_rank in [-1, 0]:
              output_dir_best_clean = os.path.join(
                  args.output_dir, "clean"
              )
              if not os.path.exists(output_dir_best_clean):
                  os.makedirs(output_dir_best_clean)
              output_model_file = os.path.join(
                  output_dir_best_clean, WEIGHTS_NAME
              )
              output_config_file = os.path.join(
                  output_dir_best_clean, CONFIG_NAME
              )
              torch.save(model_to_save.state_dict(), output_model_file)
              model_to_save.config.to_json_file(output_config_file)
              tokenizer.save_vocabulary(output_dir_best_clean)
              if args.deepspeed:
                  new_json_path = os.path.join(
                      args.output_dir, "ds_config.json"
                  )
                  with open(new_json_path, "w") as f:
                      json.dump(ds_config, f)
  
imports: import torch
  from torch.nn import CrossEntropyLoss, MSELoss
  import datasets
  from datasets import load_dataset, load_metric
  import copy
  import os
  import json
  import transformers
  from transformers import AutoConfig, PretrainedConfig
  import huggingface_transformer
  from huggingface_transformer.modeling_bert import BertForSequenceClassification
  import logging
  import numpy
  import math
label_desc: Use image node_id 13 for calling a global function with example usage: save_clean_best_model(args, print_rank_0, model, tokenizer, config, redundancy_clean, eval_dataloader, mm_eval_dataloader, device, is_regression, previous_best, best_dev_acc, ds_config) without return types