class_docstr: Tensorizer for BERT tasks.  Works for single sentence, sentence pair, triples etc.
class_docstr_tok: ["Tensorizer","for","BERT","tasks",".","Works","for","single","sentence",",","sentence","pair",",","triples","etc","."]
docstr: from_config parses the config associated with the tensorizer and
  creates both the tokenizer and the Vocabulary object. The extra arguments
  passed as kwargs allow us to reuse thie function with variable number
  of arguments (eg: for classes which derive from this class).
code: def from_config(cls, config: Config, **kwargs):
      """
      from_config parses the config associated with the tensorizer and
      creates both the tokenizer and the Vocabulary object. The extra arguments
      passed as kwargs allow us to reuse thie function with variable number
      of arguments (eg: for classes which derive from this class).
      """
      tokenizer = create_component(
          ComponentType.TOKENIZER, config.tokenizer
      )
      special_token_replacements = {
          "[UNK]": UNK,
          "[PAD]": PAD,
          "[CLS]": BOS,
          "[MASK]": MASK,
          "[SEP]": EOS,
      }
      if isinstance(tokenizer, WordPieceTokenizer):
          vocab = Vocabulary(
              [token for token, _ in tokenizer.vocab.items()],
              replacements=special_token_replacements,
          )
      else:
          config.vocab_file = (
              resources.roberta.RESOURCE_MAP[config.vocab_file]
              if config.vocab_file in resources.roberta.RESOURCE_MAP
              else config.vocab_file
          )
          with PathManager.open(config.vocab_file) as file_path:
              vocab = build_fairseq_vocab(
                  dictionary_class=BertDictionary,
                  vocab_file=file_path,
                  special_token_replacements=special_token_replacements,
              )
      return cls(
          columns=config.columns,
          vocab=vocab,
          tokenizer=tokenizer,
          max_seq_len=config.max_seq_len,
          **kwargs,
      )
  
imports: from typing import Any, Dict, List, Optional, Tuple
  import torch
  from fairseq.data.dictionary import Dictionary
  from fairseq.data.legacy.masked_lm_dictionary import BertDictionary
  from pytext import resources
  from pytext.common.constants import Token
  from pytext.config.component import ComponentType, create_component
  from pytext.data.tensorizers import Tensorizer, TensorizerScriptImpl
  from pytext.data.tokenizers import Tokenizer, WordPieceTokenizer
  from pytext.data.utils import BOS, EOS, MASK, PAD, UNK, Vocabulary
  from pytext.torchscript.tensorizer.tensorizer import VocabLookup
  from pytext.torchscript.utils import pad_2d_mask, ScriptBatchInput
  from pytext.torchscript.vocab import ScriptVocabulary
  from pytext.utils.file_io import PathManager
  from pytext.utils.lazy import lazy_property
  from pytorch.text.fb.utils.transform_utils import pad_2d
label_desc: Use image node_id 1 for calling the BERTTensorizer obj's underlying member method code with example usage: obj.from_config(cls, config) and returns: cls