class_docstr: Reranker models based on huggingface/transformers library
docstr: :param query:
  :param choices:
  :return: Encoded tokens
code: def encode(self, query: str, choices: List[str]):
      """
      :param query:
      :param choices:
      :return: Encoded tokens
      """
      inputs = [
          self.tokenizer.encode_plus(
              query,
              choice,
              add_special_tokens=True,
              return_token_type_ids=True,
              max_length=self.max_seq_len,
          )
          for choice in choices
      ]
  
      max_len = min(
          max(len(t["input_ids"]) for t in inputs), self.max_seq_len
      )
      input_ids = [
          t["input_ids"][:max_len]
          + [0] * (max_len - len(t["input_ids"][:max_len]))
          for t in inputs
      ]
      attention_mask = [
          [1] * len(t["input_ids"][:max_len])
          + [0] * (max_len - len(t["input_ids"][:max_len]))
          for t in inputs
      ]
      token_type_ids = [
          t["token_type_ids"][:max_len]
          + [0] * (max_len - len(t["token_type_ids"][:max_len]))
          for t in inputs
      ]
  
      input_ids = torch.tensor(input_ids).to(
          self.device, non_blocking=True
      )
      attention_mask = torch.tensor(attention_mask).to(
          self.device, non_blocking=True
      )
      token_type_ids = torch.tensor(token_type_ids).to(
          self.device, non_blocking=True
      )
  
      return input_ids, attention_mask, token_type_ids
  
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 3 for calling the PtTransformersRerankPlugin obj's underlying member method code with example usage: obj.encode(query, choices) and returns: input_ids,  attention_mask,  token_type_ids