class_docstr: Transformers base model (for working with pytorch-transformers models)
class_docstr_tok: ["Transformers","base","model","(","for","working","with","pytorch-transformers","models",")"]
docstr: Save model/tokenizer/arguments to given output directory
  
  Args:
      output_dir (str): path to output directory
      save_checkpoint (bool, optional): save as checkpoint. Defaults to False.
      args ([type], optional): arguments object to save. Defaults to None.
docstr_tok: ["Save","model\/tokenizer\/arguments","to","given","output","directory","Args",":","output_dir","(","str",")",":","path","to","output","directory","save_checkpoint","(","bool",",","optional",")",":","save","as","checkpoint",".","Defaults","to","False",".","args","(","[","type","]",",","optional",")",":","arguments","object","to","save",".","Defaults","to","None","."]
code: def save_model(
      self, output_dir: str, save_checkpoint: bool = False, args=None
  ):
      """
      Save model/tokenizer/arguments to given output directory
  
      Args:
          output_dir (str): path to output directory
          save_checkpoint (bool, optional): save as checkpoint. Defaults to False.
          args ([type], optional): arguments object to save. Defaults to None.
      """
      # Create output directory if needed
      if not os.path.exists(output_dir):
          os.makedirs(output_dir)
  
      logger.info("Saving model checkpoint to %s", output_dir)
      model_to_save = (
          self.model.module
          if hasattr(self.model, "module")
          else self.model
      )
      model_to_save.save_pretrained(output_dir)
      if not save_checkpoint:
          if self.tokenizer is not None:
              self.tokenizer.save_pretrained(output_dir)
          with io.open(
              output_dir + os.sep + "labels.txt", "w", encoding="utf-8"
          ) as fw:
              for label in self.labels:
                  fw.write("{}\n".format(label))
          if args is not None:
              torch.save(
                  args, os.path.join(output_dir, "training_args.bin")
              )
  
imports: import io
  import logging
  import os
  from typing import List, Union
  import torch
  from torch.utils.data import DataLoader
  from tqdm import tqdm, trange
  from transformers import AdamW, BertConfig, BertTokenizer, RobertaConfig, RobertaTokenizer, XLMConfig, XLMTokenizer, XLNetConfig, XLNetTokenizer, get_linear_schedule_with_warmup
  from nlp_architect.models import TrainableModel
  from nlp_architect.models.transformers.quantized_bert import QuantizedBertConfig
label_desc: Use image node_id 10 for calling the TransformerBase obj's underlying member method code with example usage: obj.save_model(output_dir, save_checkpoint, args) without return types