code: def __init__(
      self,
      max_seq_length: int,
      tokenizer: PreTrainedTokenizer,
      truncate_method: Optional[str] = "tail",
      create_token_type_ids: Optional[str] = False,
      **kwargs,
  ):
      self.max_seq_length = max_seq_length
  
      self.tokenizer = tokenizer
      if truncate_method == "tail":
          self.truncate_fct = self.truncate_from_tail
      elif truncate_method == "head":
          self.truncate_fct = self.truncate_from_head
      elif truncate_method == "balanced":
          self.truncate_fct = self.balanced_truncate
      else:
          raise NotImplementedError
  
      self.create_token_type_ids = create_token_type_ids
  
      self.template_mask_token = "<mask>"
      self.template_eos_token = "<eos>"
      self.template_bos_token = "<bos>"
      self.template_sep_token = "<sep>"
      self.template_cls_token = "<cls>"
      self.template_pad_token = "<pad>"
  
      from transformers import logging
  
      verbosity_before = logging.get_verbosity()
      logging.set_verbosity(
          logging.CRITICAL
      )  # TODO solve this in a more elegant way
      self.mask_token_map = {
          self.template_mask_token: self.tokenizer.mask_token
          if hasattr(self.tokenizer, "mask_token")
          else ""
      }
      self.eos_token_map = {
          self.template_eos_token: self.tokenizer.eos_token
          if hasattr(self.tokenizer, "eos_token")
          else ""
      }
      self.bos_token_map = {
          self.template_bos_token: self.tokenizer.bos_token
          if hasattr(self.tokenizer, "bos_token")
          else ""
      }
      self.sep_token_map = {
          self.template_sep_token: self.tokenizer.sep_token
          if hasattr(self.tokenizer, "sep_token")
          else ""
      }
      self.cls_token_map = {
          self.template_cls_token: self.tokenizer.cls_token
          if hasattr(self.tokenizer, "cls_token")
          else ""
      }
      self.pad_token_map = {
          self.template_pad_token: self.tokenizer.pad_token
          if hasattr(self.tokenizer, "pad_token")
          else ""
      }
      logging.set_verbosity(verbosity_before)
  
      self.num_truncated_sentences = 0
      self.total_passed_sentences = 0
  
imports: import itertools
  import warnings
  import torch
  import torch.nn
  from torch.utils.data import Dataset
  from typing import Union, List, Tuple, Dict, Optional
  from transformers.data.processors.utils import InputExample, InputFeatures
  from transformers.tokenization_utils import PreTrainedTokenizer
  from collections import defaultdict
  from openprompt.utils import round_list
  import numpy
label_desc: Use image node_id 1 to create a new TokenizerWrapper object  with example: obj = TokenizerWrapper(max_seq_length, tokenizer, truncate_method, create_token_type_ids)