class_docstr: Generates target sentence/ids using a base model.
  
  It generates target sentence/ids for a model (a pretrained transformer model or a function).
class_docstr_tok: ["Generates","target","sentence\/ids","using","a","base","model",".","It","generates","target","sentence\/ids","for","a","model","(","a","pretrained","transformer","model","or","a","function",")","."]
docstr: The function tokenizes source sentences.
  
  In model agnostic case, the function calls model(X) which is expected to
  return a batch of output sentences which is tokenized to compute inputs.
  
  Parameters
  ----------
  X: numpy.ndarray
      X is a batch of sentences.
  
  Returns
  -------
  dict
      Dictionary of padded source sentence ids and attention mask as tensors("pt" or "tf" based on model_type).
docstr_tok: ["The","function","tokenizes","source","sentences",".","In","model","agnostic","case",",","the","function","calls","model","(","X",")","which","is","expected","to","return","a","batch","of","output","sentences","which","is","tokenized","to","compute","inputs",".","Parameters","--","--","--","--","--","X",":","numpy.ndarray","X","is","a","batch","of","sentences",".","Returns","--","--","--","-","dict","Dictionary","of","padded","source","sentence","ids","and","attention","mask","as","tensors","(","``","pt","''","or","``","tf","''","based","on","model_type",")","."]
code: def get_inputs(self, X, padding_side="right"):
      """The function tokenizes source sentences.
  
      In model agnostic case, the function calls model(X) which is expected to
      return a batch of output sentences which is tokenized to compute inputs.
  
      Parameters
      ----------
      X: numpy.ndarray
          X is a batch of sentences.
  
      Returns
      -------
      dict
          Dictionary of padded source sentence ids and attention mask as tensors("pt" or "tf" based on model_type).
      """
      # set tokenizer padding to prepare inputs for batch inferencing
      # padding_side="left" for only decoder models text generation eg. GPT2
      self.tokenizer.padding_side = padding_side
      inputs = self.tokenizer(
          X.tolist(), return_tensors=self.model_type, padding=True
      )
      # set tokenizer padding to default
      self.tokenizer.padding_side = "right"
      return inputs
  
file_path: shap/shap/models/_text_generation.py
imports: import numpy
  from .._serializable import Deserializer, Serializer
  from ..utils import safe_isinstance
  from ._model import Model
label_desc: Use image node_id 3 for calling the TextGeneration obj's underlying member method code with example usage: obj.get_inputs(X, padding_side) and returns: inputs