class_docstr: BERT-based sequence classifier
docstr: Initializes the classifier and the underlying pretrained model.
  
  Args:
      language (Language, optional): The pretrained model's language.
                                     Defaults to Language.ENGLISH.
      num_labels (int, optional): The number of unique labels in the
          training data. Defaults to 2.
      cache_dir (str, optional): Location of BERT's cache directory.
          Defaults to ".".
docstr_tok: ["Initializes","the","classifier","and","the","underlying","pretrained","model",".","Args",":","language","(","Language",",","optional",")",":","The","pretrained","model","'s","language",".","Defaults","to","Language.ENGLISH",".","num_labels","(","int",",","optional",")",":","The","number","of","unique","labels","in","the","training","data",".","Defaults","to","2.","cache_dir","(","str",",","optional",")",":","Location","of","BERT","'s","cache","directory",".","Defaults","to","``",".","``","."]
code: def __init__(
      self, language=Language.ENGLISH, num_labels=2, cache_dir="."
  ):
      """Initializes the classifier and the underlying pretrained model.
  
      Args:
          language (Language, optional): The pretrained model's language.
                                         Defaults to Language.ENGLISH.
          num_labels (int, optional): The number of unique labels in the
              training data. Defaults to 2.
          cache_dir (str, optional): Location of BERT's cache directory.
              Defaults to ".".
      """
      if num_labels < 2:
          raise ValueError("Number of labels should be at least 2.")
  
      self.language = language
      self.num_labels = num_labels
      self.cache_dir = cache_dir
  
      # create classifier
      self.model = BertForSequenceClassification.from_pretrained(
          language, cache_dir=cache_dir, num_labels=num_labels
      )
      self.has_cuda = self.cuda
  
imports: import logging
  import warnings
  from collections.abc import Iterable
  from enum import Enum
  import torch
  from pytorch_pretrained_bert.tokenization import BertTokenizer
  from tqdm import tqdm
  import numpy
  import torch.nn
  from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset
  from pytorch_pretrained_bert.modeling import BertForSequenceClassification
  from pytorch_pretrained_bert.optimization import BertAdam
  from interpret_text.experimental.common.utils_pytorch import get_device, move_to_device
  from interpret_text.experimental.common.constants import BertTokens
  from collections import namedtuple
  from cached_property import cached_property
label_desc: Use image node_id 1 to create a new BERTSequenceClassifier object  with example: obj = BERTSequenceClassifier(language, num_labels, cache_dir)