class_docstr: Pre-trained XLNet Tokenizer.
  
  Args:
      pretrained_model_name (optional): a `str`, the name of
          pre-trained model (e.g., `xlnet-base-uncased`). Please refer to
          :class:`~texar.torch.modules.PretrainedXLNetMixin` for
          all supported models.
          If None, the model name in :attr:`hparams` is used.
      cache_dir (optional): the path to a folder in which the
          pre-trained models will be cached. If `None` (default),
          a default directory (``texar_data`` folder under user's home
          directory) will be used.
      hparams (dict or HParams, optional): Hyperparameters. Missing
          hyperparameter will be set to default values. See
          :meth:`default_hparams` for the hyperparameter structure
          and default values.
class_docstr_tok: ["Pre-trained","XLNet","Tokenizer",".","Args",":","pretrained_model_name","(","optional",")",":","a","`","str","`",",","the","name","of","pre-trained","model","(","e.g.",",","`","xlnet-base-uncased","`",")",".","Please","refer","to",":","class",":","`","~texar.torch.modules.PretrainedXLNetMixin","`","for","all","supported","models",".","If","None",",","the","model","name","in",":","attr",":","`","hparams","`","is","used",".","cache_dir","(","optional",")",":","the","path","to","a","folder","in","which","the","pre-trained","models","will","be","cached",".","If","`","None","`","(","default",")",",","a","default","directory","(","``","texar_data","``","folder","under","user","'s","home","directory",")","will","be","used",".","hparams","(","dict","or","HParams",",","optional",")",":","Hyperparameters",".","Missing","hyperparameter","will","be","set","to","default","values",".","See",":","meth",":","`","default_hparams","`","for","the","hyperparameter","structure","and","default","values","."]
code: def __init__(
      self,
      pretrained_model_name: Optional[str] = None,
      cache_dir: Optional[str] = None,
      hparams=None,
  ):
      self.load_pretrained_config(
          pretrained_model_name, cache_dir, hparams
      )
  
      super().__init__(hparams=None)
  
      self.__dict__: Dict
  
      self.config = {
          "do_lower_case": self.hparams["do_lower_case"],
          "remove_space": self.hparams["remove_space"],
          "keep_accents": self.hparams["keep_accents"],
      }
  
      if self.pretrained_model_dir is not None:
          vocab_file = os.path.join(
              self.pretrained_model_dir,
              self._VOCAB_FILE_NAMES["vocab_file"],
          )
          assert pretrained_model_name is not None
          if self._MAX_INPUT_SIZE.get(pretrained_model_name):
              self.max_len = self._MAX_INPUT_SIZE[pretrained_model_name]
      else:
          vocab_file = self.hparams["vocab_file"]
          if self.hparams.get("max_len"):
              self.max_len = self.hparams["max_len"]
  
      if not os.path.isfile(vocab_file):
          raise ValueError(
              "Can't find a vocabulary file at path "
              "'{}".format(vocab_file)
          )
  
      self.do_lower_case = self.hparams["do_lower_case"]
      self.remove_space = self.hparams["remove_space"]
      self.keep_accents = self.hparams["keep_accents"]
      self.vocab_file = vocab_file
  
      self.sp_model = spm.SentencePieceProcessor()
      self.sp_model.Load(self.vocab_file)
  
imports: from typing import Any, Dict, List, Optional, Tuple
  import os
  import unicodedata
  from shutil import copyfile
  import sentencepiece
  from texar.tf.modules.pretrained.xlnet import PretrainedXLNetMixin
  from texar.tf.data.tokenizers.tokenizer_base import TokenizerBase
  from texar.tf.utils.utils import truncate_seq_pair
label_desc: Use image node_id 1 to create a new XLNetTokenizer object from inherited base classes: PretrainedXLNetMixin, TokenizerBase with example: obj = XLNetTokenizer(pretrained_model_name, cache_dir, hparams)