code: def save_model(model, tokenizer, output_dir):
      """Saves the model and the tokenizer used in the output directory."""
      if not os.path.exists(output_dir):
          os.makedirs(output_dir)
  
      model_to_save = (
          model.module if hasattr(model, "module") else model
      )
      output_model_file = os.path.join(output_dir, WEIGHTS_NAME)
      output_config_file = os.path.join(output_dir, 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)
  
file_path: BLINK/elq/candidate_ranking/utils.py
imports: import os
  import io
  import sys
  import json
  import torch
  import logging
  import numpy
  from collections import OrderedDict
  from pytorch_transformers.modeling_utils import CONFIG_NAME, WEIGHTS_NAME
  from tqdm import tqdm
  from elq.biencoder.biencoder import BiEncoderRanker
label_desc: Use image node_id 4 for calling a global function with example usage: save_model(model, tokenizer, output_dir) without return types