code: def save_checkpoint_and_config(
      args, model, config, tokenizer, ds_config=None
  ):
      WEIGHTS_NAME = "pytorch_model.bin"
      CONFIG_NAME = "config.json"
      output_dir = os.path.join(args.output_dir, "best")
      if not os.path.exists(output_dir):
          os.makedirs(output_dir)
  
      output_model_file = os.path.join(output_dir, WEIGHTS_NAME)
      output_config_file = os.path.join(output_dir, CONFIG_NAME)
      ### get the model to be saved
      model_to_save = (
          model.module if hasattr(model, "module") else model
      )
      model_will_save = copy.deepcopy(model_to_save)
      if ds_config is None:
          if args.local_rank in [-1, 0]:
              torch.save(
                  model_will_save.state_dict(), output_model_file
              )
              model_to_save.config.to_json_file(output_config_file)
      else:
          if args.local_rank in [-1, 0]:
              torch.save(
                  model_will_save.state_dict(), output_model_file
              )
              model_to_save.config.to_json_file(output_config_file)
              tokenizer.save_vocabulary(output_dir)
              if args.deepspeed:
                  new_json_path = os.path.join(
                      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 12 for calling a global function with example usage: save_checkpoint_and_config(args, model, config, tokenizer, ds_config) without return types