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: Generates target sentence/ids from X.
  
  Parameters
  ----------
  X: str or numpy.ndarray
      Input in the form of text or image.
  
  Returns
  -------
  numpy.ndarray
      Array of target sentence/ids.
docstr_tok: ["Generates","target","sentence\/ids","from","X.","Parameters","--","--","--","--","--","X",":","str","or","numpy.ndarray","Input","in","the","form","of","text","or","image",".","Returns","--","--","--","-","numpy.ndarray","Array","of","target","sentence\/ids","."]
code: def __call__(self, X):
      """Generates target sentence/ids from X.
  
      Parameters
      ----------
      X: str or numpy.ndarray
          Input in the form of text or image.
  
      Returns
      -------
      numpy.ndarray
          Array of target sentence/ids.
      """
      if (
          (self.X is None)
          or (
              isinstance(self.X, np.ndarray)
              and not np.array_equal(self.X, X)
          )
          or (isinstance(self.X, str) and (self.X != X))
      ):
          self.X = X
          # wrap text input in a numpy array
          if isinstance(X, str):
              X = np.array([X])
          # generate target sentence ids in model agnostic scenario
          if self.model_agnostic:
              self.target_X = self.inner_model(X)
          else:
              self.target_X = self.model_generate(X)
          # update explanation row count
          self.explanation_row += 1
      return np.array(self.target_X)
  
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 2 for calling the TextGeneration obj's underlying member method code with example usage: obj.__call__(X) and returns: np