class_docstr: Transformers base model (for working with pytorch-transformers models)
class_docstr_tok: ["Transformers","base","model","(","for","working","with","pytorch-transformers","models",")"]
docstr: Transformers base model (for working with pytorch-transformers models)
  
  Args:
      model_type (str): transformer model type
      model_name_or_path (str): model name or path to model
      labels (List[str], optional): list of labels. Defaults to None.
      num_labels (int, optional): number of labels. Defaults to None.
      config_name ([type], optional): configuration name. Defaults to None.
      tokenizer_name ([type], optional): tokenizer name. Defaults to None.
      do_lower_case (bool, optional): lower case input words. Defaults to False.
      output_path ([type], optional): model output path. Defaults to None.
      device (str, optional): backend device. Defaults to 'cpu'.
      n_gpus (int, optional): num of gpus. Defaults to 0.
  
  Raises:
      FileNotFoundError: [description]
docstr_tok: ["Transformers","base","model","(","for","working","with","pytorch-transformers","models",")","Args",":","model_type","(","str",")",":","transformer","model","type","model_name_or_path","(","str",")",":","model","name","or","path","to","model","labels","(","List","[","str","]",",","optional",")",":","list","of","labels",".","Defaults","to","None",".","num_labels","(","int",",","optional",")",":","number","of","labels",".","Defaults","to","None",".","config_name","(","[","type","]",",","optional",")",":","configuration","name",".","Defaults","to","None",".","tokenizer_name","(","[","type","]",",","optional",")",":","tokenizer","name",".","Defaults","to","None",".","do_lower_case","(","bool",",","optional",")",":","lower","case","input","words",".","Defaults","to","False",".","output_path","(","[","type","]",",","optional",")",":","model","output","path",".","Defaults","to","None",".","device","(","str",",","optional",")",":","backend","device",".","Defaults","to","'cpu","'",".","n_gpus","(","int",",","optional",")",":","num","of","gpus",".","Defaults","to","0",".","Raises",":","FileNotFoundError",":","[","description","]"]
code: def __init__(
      self,
      model_type: str,
      model_name_or_path: str,
      labels: List[str] = None,
      num_labels: int = None,
      config_name=None,
      tokenizer_name=None,
      do_lower_case=False,
      output_path=None,
      device="cpu",
      n_gpus=0,
  ):
      """
      Transformers base model (for working with pytorch-transformers models)
  
      Args:
          model_type (str): transformer model type
          model_name_or_path (str): model name or path to model
          labels (List[str], optional): list of labels. Defaults to None.
          num_labels (int, optional): number of labels. Defaults to None.
          config_name ([type], optional): configuration name. Defaults to None.
          tokenizer_name ([type], optional): tokenizer name. Defaults to None.
          do_lower_case (bool, optional): lower case input words. Defaults to False.
          output_path ([type], optional): model output path. Defaults to None.
          device (str, optional): backend device. Defaults to 'cpu'.
          n_gpus (int, optional): num of gpus. Defaults to 0.
  
      Raises:
          FileNotFoundError: [description]
      """
      assert (
          model_type in self.MODEL_CONFIGURATIONS.keys()
      ), "unsupported model_type"
      self.model_type = model_type
      self.model_name_or_path = model_name_or_path
      self.labels = labels
      self.num_labels = num_labels
      self.do_lower_case = do_lower_case
      if output_path is not None and not os.path.exists(output_path):
          raise FileNotFoundError("output_path is not found")
      self.output_path = output_path
  
      self.model_class = None
      config_class, tokenizer_class = self.MODEL_CONFIGURATIONS[
          model_type
      ]
      self.config_class = config_class
      self.tokenizer_class = tokenizer_class
  
      self.tokenizer_name = tokenizer_name
      self.tokenizer = self._load_tokenizer(self.tokenizer_name)
      self.config_name = config_name
      self.config = self._load_config(config_name)
  
      self.model = None
      self.device = device
      self.n_gpus = n_gpus
  
      self._optimizer = None
      self._scheduler = None
  
      self.training_args = None
  
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 1 to create a new TransformerBase object from inherited base classes: TrainableModel with example: obj = TransformerBase(model_type, model_name_or_path, labels, num_labels, config_name, tokenizer_name, do_lower_case, output_path, device, n_gpus)