class_docstr: Transformer word tagging classifier
  Args:
      model_type(str): model family (classifier head), choose between bert/quant_bert/xlnet
      labels (List[str], optional): list of tag labels
class_docstr_tok: ["Transformer","word","tagging","classifier","Args",":","model_type","(","str",")",":","model","family","(","classifier","head",")",",","choose","between","bert\/quant_bert\/xlnet","labels","(","List","[","str","]",",","optional",")",":","list","of","tag","labels"]
code: def __init__(
      self,
      model_type: str,
      labels: List[str] = None,
      training_args: bool = None,
      *args,
      load_quantized=False,
      **kwargs,
  ):
      assert (
          model_type in self.MODEL_CLASS.keys()
      ), "unsupported model type"
      self.labels = labels
      self.num_labels = len(labels) + 1  # +1 for padding label
      self.labels_id_map = {k: v for k, v in enumerate(self.labels, 1)}
  
      super(TransformerTokenClassifier, self).__init__(
          model_type,
          labels=self.labels,
          num_labels=self.num_labels,
          *args,
          **kwargs,
      )
  
      self.model_class = self.MODEL_CLASS[model_type]
      if model_type == "quant_bert" and load_quantized:
          self.model = self.model_class.from_pretrained(
              self.model_name_or_path,
              from_tf=bool(".ckpt" in self.model_name_or_path),
              config=self.config,
              from_8bit=load_quantized,
          )
      else:
          self.model = self.model_class.from_pretrained(
              self.model_name_or_path,
              from_tf=bool(".ckpt" in self.model_name_or_path),
              config=self.config,
          )
      self.training_args = training_args
      self.to(self.device, self.n_gpus)
  
imports: import logging
  from typing import List, Union
  import torch
  from torch.nn import CrossEntropyLoss, Dropout, Linear
  from torch.nn import functional
  from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
  from transformers import ROBERTA_PRETRAINED_MODEL_ARCHIVE_MAP, BertForTokenClassification, BertPreTrainedModel, RobertaConfig, RobertaModel, XLNetModel, XLNetPreTrainedModel
  from nlp_architect.data.sequential_tagging import TokenClsInputExample
  from nlp_architect.models.transformers.base_model import InputFeatures, TransformerBase
  from nlp_architect.models.transformers.quantized_bert import QuantizedBertForTokenClassification
  from nlp_architect.utils.metrics import tagging
label_desc: Use image node_id 1 to create a new TransformerTokenClassifier object from inherited base classes: TransformerBase with example: obj = TransformerTokenClassifier(model_type, labels, training_args)