class_docstr: Transformer sequence classifier
  
  Args:
      model_type (str): transformer base model type
      labels (List[str], optional): list of labels. Defaults to None.
      task_type (str, optional): task type (classification/regression). Defaults to
      classification.
      metric_fn ([type], optional): metric to use for evaluation. Defaults to
      simple_accuracy.
class_docstr_tok: ["Transformer","sequence","classifier","Args",":","model_type","(","str",")",":","transformer","base","model","type","labels","(","List","[","str","]",",","optional",")",":","list","of","labels",".","Defaults","to","None",".","task_type","(","str",",","optional",")",":","task","type","(","classification\/regression",")",".","Defaults","to","classification",".","metric_fn","(","[","type","]",",","optional",")",":","metric","to","use","for","evaluation",".","Defaults","to","simple_accuracy","."]
code: def __init__(
      self,
      model_type: str,
      labels: List[str] = None,
      task_type="classification",
      metric_fn=accuracy,
      load_quantized=False,
      *args,
      **kwargs,
  ):
      assert (
          model_type in self.MODEL_CLASS.keys()
      ), "unsupported model type"
      self.labels = labels
      self.num_labels = len(labels)
      super(TransformerSequenceClassifier, self).__init__(
          model_type,
          labels=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.task_type = task_type
      self.metric_fn = metric_fn
      self.to(self.device, self.n_gpus)
  
file_path: nlp-architect/nlp_architect/models/transformers/sequence_classification.py
imports: import logging
  import os
  from typing import List, Union
  import numpy
  import torch
  from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
  from transformers import BertForSequenceClassification, RobertaForSequenceClassification, XLMForSequenceClassification, XLNetForSequenceClassification
  from nlp_architect.data.sequence_classification import SequenceClsInputExample
  from nlp_architect.models.transformers.base_model import InputFeatures, TransformerBase
  from nlp_architect.models.transformers.quantized_bert import QuantizedBertForSequenceClassification
  from nlp_architect.utils.metrics import accuracy
label_desc: Use image node_id 1 to create a new TransformerSequenceClassifier object from inherited base classes: TransformerBase with example: obj = TransformerSequenceClassifier(model_type, labels, task_type, metric_fn, load_quantized)