class_docstr: Bert-based model for text classification on PyTorch.
  
  It uses output from [CLS] token and predicts labels using linear transformation.
  
  Args:
      n_classes: number of classes
      pretrained_bert: pretrained Bert checkpoint path or key title (e.g. "bert-base-uncased")
      multilabel: set True if it is multi-label classification
      return_probas: set True if return class probabilites instead of most probable label needed
      attention_probs_keep_prob: keep_prob for Bert self-attention layers
      hidden_keep_prob: keep_prob for Bert hidden layers
      bert_config_file: path to Bert configuration file (not used if pretrained_bert is key title)
      is_binary: whether classification task is binary or multi-class
      num_special_tokens: number of special tokens used by classification model
class_docstr_tok: ["Bert-based","model","for","text","classification","on","PyTorch",".","It","uses","output","from","[","CLS","]","token","and","predicts","labels","using","linear","transformation",".","Args",":","n_classes",":","number","of","classes","pretrained_bert",":","pretrained","Bert","checkpoint","path","or","key","title","(","e.g",".","``","bert-base-uncased","''",")","multilabel",":","set","True","if","it","is","multi-label","classification","return_probas",":","set","True","if","return","class","probabilites","instead","of","most","probable","label","needed","attention_probs_keep_prob",":","keep_prob","for","Bert","self-attention","layers","hidden_keep_prob",":","keep_prob","for","Bert","hidden","layers","bert_config_file",":","path","to","Bert","configuration","file","(","not","used","if","pretrained_bert","is","key","title",")","is_binary",":","whether","classification","task","is","binary","or","multi-class","num_special_tokens",":","number","of","special","tokens","used","by","classification","model"]
docstr: Make prediction for given features (texts).
  
  Args:
      features: batch of InputFeatures
  
  Returns:
      predicted classes or probabilities of each class
docstr_tok: ["Make","prediction","for","given","features","(","texts",")",".","Args",":","features",":","batch","of","InputFeatures","Returns",":","predicted","classes","or","probabilities","of","each","class"]
code: def __call__(
      self, features: Dict[str, torch.tensor]
  ) -> Union[List[int], List[List[float]]]:
      """Make prediction for given features (texts).
  
      Args:
          features: batch of InputFeatures
  
      Returns:
          predicted classes or probabilities of each class
  
      """
  
      _input = {
          key: value.to(self.device) for key, value in features.items()
      }
  
      with torch.no_grad():
          tokenized = {
              key: value
              for (key, value) in _input.items()
              if key in self.accepted_keys
          }
  
          # Forward pass, calculate logit predictions
          logits = self.model(**tokenized)
          logits = logits[0]
  
      if self.return_probas:
          if self.is_binary:
              pred = torch.sigmoid(logits).squeeze(1)
          elif not self.multilabel:
              pred = torch.nn.functional.softmax(logits, dim=-1)
          else:
              pred = torch.nn.functional.sigmoid(logits)
          pred = pred.detach().cpu().numpy()
      elif self.n_classes > 1:
          logits = logits.detach().cpu().numpy()
          pred = np.argmax(logits, axis=1)
      # regression
      else:
          pred = logits.squeeze(-1).detach().cpu().numpy()
  
      return pred
  
imports: from logging import getLogger
  from pathlib import Path
  from typing import List, Dict, Union, Optional, Tuple
  import numpy
  import torch
  from torch.nn import BCEWithLogitsLoss
  from transformers import AutoModelForSequenceClassification, AutoConfig, AutoModel, AutoTokenizer
  from transformers.modeling_outputs import SequenceClassifierOutput
  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
label_desc: Use image node_id 3 for calling the TorchTransformersClassifierModel obj's underlying member method code with example usage: obj.__call__(features) and returns: pred