class_docstr: Class for obtaining the BERT output for CLS-token and special entity token
  Args:
      pretrained_bert: pretrained Bert checkpoint path or key title (e.g. "bert-base-uncased")
      bert_config_file: path to Bert configuration file, or None, if `pretrained_bert` is a string name
      device: device to use
code: def __init__(
      self,
      pretrained_bert: str = None,
      bert_config_file: str = None,
      device: torch.device = torch.device("cpu"),
  ):
      super().__init__()
      self.pretrained_bert = pretrained_bert
      self.bert_config_file = bert_config_file
      self.encoder, self.config, self.bert_config = None, None, None
      self.device = device
      self.load()
      self.tokenizer = AutoTokenizer.from_pretrained(
          self.pretrained_bert
      )
      self.encoder.resize_token_embeddings(len(self.tokenizer) + 1)
      self.encoder.to(self.device)
  
imports: from logging import getLogger
  from pathlib import Path
  from typing import List, Optional, Dict, Tuple, Union, Any
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from transformers import AutoConfig, AutoTokenizer, AutoModel
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.torch_model import TorchModel
  from deeppavlov.models.preprocessors.torch_transformers_preprocessor import TorchTransformersEntityRankerPreprocessor
label_desc: Use image node_id 1 to create a new TextEncoder object from inherited base classes: nn with example: obj = TextEncoder(pretrained_bert, bert_config_file, device)