class_docstr: Transformers-based BERT model for embeddings tokens, subtokens and sentences
  
  Args:
      load_path: path to a pretrained BERT pytorch checkpoint
      bert_config_file: path to a BERT configuration file
      truncate: whether to remove zero-paddings from returned data
class_docstr_tok: ["Transformers-based","BERT","model","for","embeddings","tokens",",","subtokens","and","sentences","Args",":","load_path",":","path","to","a","pretrained","BERT","pytorch","checkpoint","bert_config_file",":","path","to","a","BERT","configuration","file","truncate",":","whether","to","remove","zero-paddings","from","returned","data"]
code: def __init__(
      self,
      load_path: Union[str, Path],
      bert_config_path: Union[str, Path] = None,
      truncate: bool = False,
      **kwargs,
  ):
      super().__init__(save_path=None, load_path=load_path, **kwargs)
      if bert_config_path is not None:
          bert_config_path = expand_path(bert_config_path)
      self.config = bert_config_path
      self.truncate = truncate
      self.device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
      self.load()
  
file_path: DeepPavlov/deeppavlov/models/embedders/transformers_embedder.py
imports: from pathlib import Path
  from typing import Union, Tuple, Collection
  import torch
  import transformers
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.serializable import Serializable
label_desc: Use image node_id 1 to create a new TransformersBertEmbedder object from inherited base classes: Serializable with example: obj = TransformersBertEmbedder(load_path, bert_config_path, truncate)