class_docstr: Reranker models based on huggingface/transformers library
code: def __init__(
      self,
      model_dir: str = "nboost/pt-tinybert-msmarco",
      verbose: bool = defaults.verbose,
      max_seq_len: int = defaults.max_seq_len,
      **kwargs,
  ):
      super().__init__(**kwargs)
      self.logger = set_logger(model_dir, verbose=verbose)
      self.max_seq_len = max_seq_len
  
      self.logger.info("Loading from checkpoint %s" % model_dir)
      self.device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
  
      if self.device == torch.device("cpu"):
          self.logger.info("RUNNING ON CPU")
      else:
          self.logger.info("RUNNING ON CUDA")
          torch.cuda.synchronize(self.device)
  
      self.rerank_model = (
          AutoModelForSequenceClassification.from_pretrained(model_dir)
      )
      self.tokenizer = AutoTokenizer.from_pretrained(
          model_dir, use_fast=True
      )
  
      self.rerank_model.to(self.device, non_blocking=True)
  
file_path: nboost/nboost/plugins/rerank/transformers.py
imports: from transformers import AutoModelForSequenceClassification, AutoTokenizer
  from typing import List
  import torch.nn
  import torch
  from nboost.plugins.rerank.base import RerankModelPlugin
  from nboost import defaults
  from nboost.logger import set_logger
label_desc: Use image node_id 1 to create a new PtTransformersRerankPlugin object from inherited base classes: RerankModelPlugin with example: obj = PtTransformersRerankPlugin(model_dir, verbose, max_seq_len)