code: def relation_save_trained_model(output_dir, model, tokenizer):
      if not os.path.exists(output_dir):
          os.mkdir(output_dir)
      logger.info("Saving model to %s" % 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)
  
imports: import argparse
  import logging
  import os
  import random
  import time
  import json
  import sys
  import numpy
  import torch
  from torch.utils.data import DataLoader, TensorDataset
  from collections import Counter
  from torch.nn import CrossEntropyLoss
  from transformers.file_utils import PYTORCH_PRETRAINED_BERT_CACHE, WEIGHTS_NAME, CONFIG_NAME
  from transformers import AutoTokenizer
  from transformers import AdamW, get_linear_schedule_with_warmup
  from models.const import *
  from models.data_structures import *
  from models.entityModels import *
  from models.entityUtils import *
  from models.relationModels import *
  from models.relationUtils import *
label_desc: Use image node_id 8 for calling a global function with example usage: relation_save_trained_model(output_dir, model, tokenizer) without return types