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 _batch_mapper(self, batch):
      mapping = {
          "input_ids": batch[0],
          "attention_mask": batch[1],
          # XLM don't use segment_ids
          "token_type_ids": batch[2],
          "valid_ids": batch[3],
      }
      if len(batch) > 4:
          mapping.update({"labels": batch[4]})
      return mapping
  
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 3 for calling the TransformerTokenClassifier obj's underlying member method code with example usage: obj._batch_mapper(batch) and returns: mapping