class_docstr: Pre-trained BERT Tokenizer.
  
  Args:
      pretrained_model_name (optional): a `str`, the name of
          pre-trained model (e.g., `bert-base-uncased`). Please refer to
          :class:`~texar.torch.modules.PretrainedBERTMixin` 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","BERT","Tokenizer",".","Args",":","pretrained_model_name","(","optional",")",":","a","`","str","`",",","the","name","of","pre-trained","model","(","e.g.",",","`","bert-base-uncased","`",")",".","Please","refer","to",":","class",":","`","~texar.torch.modules.PretrainedBERTMixin","`","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","."]
docstr: Returns a dictionary of hyperparameters with default values.
  
  * The tokenizer is determined by the constructor argument
    :attr:`pretrained_model_name` if it's specified. In this case,
    `hparams` are ignored.
  * Otherwise, the tokenizer is determined by
    `hparams['pretrained_model_name']` if it's specified. All other
    configurations in `hparams` are ignored.
  * If the above two are `None`, the tokenizer is defined by the
    configurations in `hparams`.
  
  .. code-block:: python
  
      {
          "pretrained_model_name": "bert-base-uncased",
          "vocab_file": None,
          "max_len": 512,
          "unk_token": "[UNK]",
          "sep_token": "[SEP]",
          "pad_token": "[PAD]",
          "cls_token": "[CLS]",
          "mask_token": "[MASK]",
          "tokenize_chinese_chars": True,
          "do_lower_case": True,
          "do_basic_tokenize": True,
          "non_split_tokens": None,
          "name": "bert_tokenizer",
      }
  
  Here:
  
  `"pretrained_model_name"`: str or None
      The name of the pre-trained BERT model.
  
  `"vocab_file"`: str or None
      The path to a one-wordpiece-per-line vocabulary file.
  
  `"max_len"`: int
      The maximum sequence length that this model might ever be used with.
  
  `"unk_token"`: str
      Unknown token.
  
  `"sep_token"`: str
      Separation token.
  
  `"pad_token"`: str
      Padding token.
  
  `"cls_token"`: str
      Classification token.
  
  `"mask_token"`: str
      Masking token.
  
  `"tokenize_chinese_chars"`: bool
      Whether to tokenize Chinese characters.
  
  `"do_lower_case"`: bool
      Whether to lower case the input
      Only has an effect when `do_basic_tokenize=True`
  
  `"do_basic_tokenize"`: bool
      Whether to do basic tokenization before wordpiece.
  
  `"non_split_tokens"`: list
      List of tokens which will never be split during tokenization.
      Only has an effect when `do_basic_tokenize=True`
  
  `"name"`: str
      Name of the tokenizer.
docstr_tok: ["Returns","a","dictionary","of","hyperparameters","with","default","values",".","*","The","tokenizer","is","determined","by","the","constructor","argument",":","attr",":","`","pretrained_model_name","`","if","it","'s","specified",".","In","this","case",",","`","hparams","`","are","ignored",".","*","Otherwise",",","the","tokenizer","is","determined","by","`","hparams","[","'pretrained_model_name","'","]","`","if","it","'s","specified",".","All","other","configurations","in","`","hparams","`","are","ignored",".","*","If","the","above","two","are","`","None","`",",","the","tokenizer","is","defined","by","the","configurations","in","`","hparams","`",".","..","code-block",":",":","python","{","``","pretrained_model_name","''",":","``","bert-base-uncased","''",",","``","vocab_file","''",":","None",",","``","max_len","''",":","512",",","``","unk_token","''",":","``","[","UNK","]","''",",","``","sep_token","''",":","``","[","SEP","]","''",",","``","pad_token","''",":","``","[","PAD","]","''",",","``","cls_token","''",":","``","[","CLS","]","''",",","``","mask_token","''",":","``","[","MASK","]","''",",","``","tokenize_chinese_chars","''",":","True",",","``","do_lower_case","''",":","True",",","``","do_basic_tokenize","''",":","True",",","``","non_split_tokens","''",":","None",",","``","name","''",":","``","bert_tokenizer","''",",","}","Here",":","`","``","pretrained_model_name","''","`",":","str","or","None","The","name","of","the","pre-trained","BERT","model",".","`","``","vocab_file","''","`",":","str","or","None","The","path","to","a","one-wordpiece-per-line","vocabulary","file",".","`","``","max_len","''","`",":","int","The","maximum","sequence","length","that","this","model","might","ever","be","used","with",".","`","``","unk_token","''","`",":","str","Unknown","token",".","`","``","sep_token","''","`",":","str","Separation","token",".","`","``","pad_token","''","`",":","str","Padding","token",".","`","``","cls_token","''","`",":","str","Classification","token",".","`","``","mask_token","''","`",":","str","Masking","token",".","`","``","tokenize_chinese_chars","''","`",":","bool","Whether","to","tokenize","Chinese","characters",".","`","``","do_lower_case","''","`",":","bool","Whether","to","lower","case","the","input","Only","has","an","effect","when","`","do_basic_tokenize=True","`","`","``","do_basic_tokenize","''","`",":","bool","Whether","to","do","basic","tokenization","before","wordpiece",".","`","``","non_split_tokens","''","`",":","list","List","of","tokens","which","will","never","be","split","during","tokenization",".","Only","has","an","effect","when","`","do_basic_tokenize=True","`","`","``","name","''","`",":","str","Name","of","the","tokenizer","."]
code: def default_hparams() -> Dict[str, Any]:
      r"""Returns a dictionary of hyperparameters with default values.
  
      * The tokenizer is determined by the constructor argument
        :attr:`pretrained_model_name` if it's specified. In this case,
        `hparams` are ignored.
      * Otherwise, the tokenizer is determined by
        `hparams['pretrained_model_name']` if it's specified. All other
        configurations in `hparams` are ignored.
      * If the above two are `None`, the tokenizer is defined by the
        configurations in `hparams`.
  
      .. code-block:: python
  
          {
              "pretrained_model_name": "bert-base-uncased",
              "vocab_file": None,
              "max_len": 512,
              "unk_token": "[UNK]",
              "sep_token": "[SEP]",
              "pad_token": "[PAD]",
              "cls_token": "[CLS]",
              "mask_token": "[MASK]",
              "tokenize_chinese_chars": True,
              "do_lower_case": True,
              "do_basic_tokenize": True,
              "non_split_tokens": None,
              "name": "bert_tokenizer",
          }
  
      Here:
  
      `"pretrained_model_name"`: str or None
          The name of the pre-trained BERT model.
  
      `"vocab_file"`: str or None
          The path to a one-wordpiece-per-line vocabulary file.
  
      `"max_len"`: int
          The maximum sequence length that this model might ever be used with.
  
      `"unk_token"`: str
          Unknown token.
  
      `"sep_token"`: str
          Separation token.
  
      `"pad_token"`: str
          Padding token.
  
      `"cls_token"`: str
          Classification token.
  
      `"mask_token"`: str
          Masking token.
  
      `"tokenize_chinese_chars"`: bool
          Whether to tokenize Chinese characters.
  
      `"do_lower_case"`: bool
          Whether to lower case the input
          Only has an effect when `do_basic_tokenize=True`
  
      `"do_basic_tokenize"`: bool
          Whether to do basic tokenization before wordpiece.
  
      `"non_split_tokens"`: list
          List of tokens which will never be split during tokenization.
          Only has an effect when `do_basic_tokenize=True`
  
      `"name"`: str
          Name of the tokenizer.
  
      """
      return {
          "pretrained_model_name": "bert-base-uncased",
          "vocab_file": None,
          "max_len": 512,
          "unk_token": "[UNK]",
          "sep_token": "[SEP]",
          "pad_token": "[PAD]",
          "cls_token": "[CLS]",
          "mask_token": "[MASK]",
          "tokenize_chinese_chars": True,
          "do_lower_case": True,
          "do_basic_tokenize": True,
          "non_split_tokens": None,
          "name": "bert_tokenizer",
          "@no_typecheck": ["pretrained_model_name"],
      }
  
file_path: texar/texar/tf/data/tokenizers/bert_tokenizer.py
imports: from typing import Any, Dict, List, Optional, Tuple
  import os
  from texar.tf.modules.pretrained.bert import PretrainedBERTMixin
  from texar.tf.data.tokenizers.tokenizer_base import TokenizerBase
  from texar.tf.data.tokenizers.bert_tokenizer_utils import load_vocab, BasicTokenizer, WordpieceTokenizer
  from texar.tf.utils.utils import truncate_seq_pair
label_desc: Use image node_id 9 for calling the BERTTokenizer obj's underlying member method code with example usage: obj.default_hparams() and returns: dict