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"]
docstr: Run inference on given examples
  
  Args:
      examples (List[SequenceClsInputExample]): examples
      batch_size (int, optional): batch size. Defaults to 64.
  
  Returns:
      logits
docstr_tok: ["Run","inference","on","given","examples","Args",":","examples","(","List","[","SequenceClsInputExample","]",")",":","examples","batch_size","(","int",",","optional",")",":","batch","size",".","Defaults","to","64",".","Returns",":","logits"]
code: def inference(
      self,
      examples: List[TokenClsInputExample],
      max_seq_length: int,
      batch_size: int = 64,
  ):
      """
      Run inference on given examples
  
      Args:
          examples (List[SequenceClsInputExample]): examples
          batch_size (int, optional): batch size. Defaults to 64.
  
      Returns:
          logits
      """
      data_set = self.convert_to_tensors(
          examples, max_seq_length=max_seq_length, include_labels=False
      )
      inf_sampler = SequentialSampler(data_set)
      inf_dataloader = DataLoader(
          data_set, sampler=inf_sampler, batch_size=batch_size
      )
      logits = self._evaluate(inf_dataloader)
      active_positions = (
          data_set.tensors[-1].view(len(data_set), -1) != 0.0
      )
      logits = torch.argmax(F.log_softmax(logits, dim=2), dim=2)
      res_ids = []
      for i in range(logits.size()[0]):
          res_ids.append(
              logits[i][active_positions[i]].detach().cpu().numpy()
          )
      output = []
      for tag_ids, ex in zip(res_ids, examples):
          tokens = ex.tokens
          tags = [self.labels_id_map.get(t, "O") for t in tag_ids]
          output.append((tokens, tags))
      return output
  
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 8 for calling the TransformerTokenClassifier obj's underlying member method code with example usage: obj.inference(examples, max_seq_length, batch_size) and returns: output