class_docstr: Predictors load models from checkpoints to perform inference.
  
  .. note::
      The base ``Predictor`` class cannot be instantiated directly. Only one of
      its subclasses can be used.
  
  **How does a Predictor work?**
  
  Predictors expose a ``predict`` method that accepts an input batch of type
  ``DataBatchType`` and outputs predictions of the same type as the input batch.
  
  When the ``predict`` method is called the following occurs:
  
  - The input batch is converted into a pandas DataFrame. Tensor input (like a
    ``np.ndarray``) will be converted into a single column Pandas Dataframe.
  - If there is a :ref:`Preprocessor <preprocessor-ref>` saved in the provided
    :class:`Checkpoint <ray.train.Checkpoint>`, the preprocessor will be used to
    transform the DataFrame.
  - The transformed DataFrame will be passed to the model for inference (via the
    ``predictor._predict_pandas`` method).
  - The predictions will be outputted by ``predict`` in the same type as the
    original input.
  
  **How do I create a new Predictor?**
  
  To implement a new Predictor for your particular framework, you should subclass
  the base ``Predictor`` and implement the following two methods:
  
  1. ``_predict_pandas``: Given a pandas.DataFrame input, return a
     pandas.DataFrame containing predictions.
  2. ``from_checkpoint``: Logic for creating a Predictor from a
     :class:`Checkpoint <ray.train.Checkpoint>`.
  3. Optionally ``_predict_numpy`` for better performance when working with
     tensor data to avoid extra copies from Pandas conversions.
docstr: Perform inference on a batch of data.
  
  Args:
      data: A batch of input data of type ``DataBatchType``.
      kwargs: Arguments specific to predictor implementations. These are passed
      directly to ``_predict_numpy`` or ``_predict_pandas``.
  
  Returns:
      DataBatchType:
          Prediction result. The return type will be the same as the input type.
docstr_tok: ["Perform","inference","on","a","batch","of","data",".","Args",":","data",":","A","batch","of","input","data","of","type","``","DataBatchType","``",".","kwargs",":","Arguments","specific","to","predictor","implementations",".","These","are","passed","directly","to","``","_predict_numpy","``","or","``","_predict_pandas","``",".","Returns",":","DataBatchType",":","Prediction","result",".","The","return","type","will","be","the","same","as","the","input","type","."]
code: def predict(self, data: DataBatchType, **kwargs) -> DataBatchType:
      """Perform inference on a batch of data.
  
      Args:
          data: A batch of input data of type ``DataBatchType``.
          kwargs: Arguments specific to predictor implementations. These are passed
          directly to ``_predict_numpy`` or ``_predict_pandas``.
  
      Returns:
          DataBatchType:
              Prediction result. The return type will be the same as the input type.
      """
      if not hasattr(self, "_preprocessor"):
          raise NotImplementedError(
              "Subclasses of Predictor must call Predictor.__init__(preprocessor)."
          )
      try:
          batch_format = TYPE_TO_ENUM[type(data)]
      except KeyError:
          raise RuntimeError(
              f"Invalid input data type of {type(data)}, supported "
              f"types: {list(TYPE_TO_ENUM.keys())}"
          )
  
      if self._preprocessor:
          data = self._preprocessor.transform_batch(data)
  
      batch_format_to_use = self._batch_format_to_use()
  
      # We can finish prediction as long as one predict method is implemented.
      # For prediction, we have to return back in the same format as the input.
      if batch_format == BatchFormat.PANDAS:
          if batch_format_to_use == BatchFormat.PANDAS:
              return self._predict_pandas(
                  _convert_batch_type_to_pandas(data), **kwargs
              )
          elif batch_format_to_use == BatchFormat.NUMPY:
              return _convert_batch_type_to_pandas(
                  self._predict_numpy(
                      _convert_batch_type_to_numpy(data), **kwargs
                  )
              )
      elif batch_format == BatchFormat.NUMPY:
          if batch_format_to_use == BatchFormat.PANDAS:
              return _convert_batch_type_to_numpy(
                  self._predict_pandas(
                      _convert_batch_type_to_pandas(data), **kwargs
                  )
              )
          elif batch_format_to_use == BatchFormat.NUMPY:
              return self._predict_numpy(
                  _convert_batch_type_to_numpy(data), **kwargs
              )
  
imports: import abc
  from typing import Callable, Dict, Optional, Type, Union
  import numpy
  import pandas
  from ray.air.data_batch_type import DataBatchType
  from ray.air.util.data_batch_conversion import BatchFormat, _convert_batch_type_to_numpy, _convert_batch_type_to_pandas
  from ray.data import Preprocessor
  from ray.train import Checkpoint
  from ray.util.annotations import DeveloperAPI, PublicAPI
label_desc: Use image node_id 9 for calling the Predictor obj's underlying member method code with example usage: obj.predict(data) and returns: self, _convert_batch_type_to_pandas, _convert_batch_type_to_numpy, self