class_docstr: Transformers handler class for sequence, token classification and question answering.
class_docstr_tok: ["Transformers","handler","class","for","sequence",",","token","classification","and","question","answering","."]
docstr: Basic text preprocessing, based on the user's choice of application mode.
  Args:
      requests (list): A list of dictionaries with a "data" or "body" field, each
                      containing the input text to be processed.
  Returns:
      tuple: A tuple with two tensors: the batch of input ids and the batch of
          attention masks.
docstr_tok: ["Basic","text","preprocessing",",","based","on","the","user","'s","choice","of","application","mode",".","Args",":","requests","(","list",")",":","A","list","of","dictionaries","with","a","``","data","''","or","``","body","''","field",",","each","containing","the","input","text","to","be","processed",".","Returns",":","tuple",":","A","tuple","with","two","tensors",":","the","batch","of","input","ids","and","the","batch","of","attention","masks","."]
code: def preprocess(self, requests):
      """
      Basic text preprocessing, based on the user's choice of application mode.
      Args:
          requests (list): A list of dictionaries with a "data" or "body" field, each
                          containing the input text to be processed.
      Returns:
          tuple: A tuple with two tensors: the batch of input ids and the batch of
              attention masks.
      """
      input_texts = [
          data.get("data") or data.get("body") for data in requests
      ]
      input_ids_batch = []
      for input_text in input_texts:
          input_ids = self.encode_input_text(input_text)
          input_ids_batch.append(input_ids)
      input_ids_batch = torch.cat(input_ids_batch, dim=0).to(
          self.device
      )
      return input_ids_batch
  
file_path: serve/examples/large_models/Huggingface_pippy/pippy_handler.py
imports: import logging
  import time
  from abc import ABC
  import packaging.version
  import requests
  import torch
  import transformers
  from transformers import AutoModelForCausalLM, AutoTokenizer
  from ts.handler_utils.distributed.pt_pippy import get_pipeline_driver
  from ts.torch_handler.distributed.base_pippy_handler import BasePippyHandler
label_desc: Use image node_id 3 for calling the TransformersSeqClassifierHandler obj's underlying member method code with example usage: obj.preprocess(requests) and returns: input_ids_batch