class_docstr: Generates scores (log odds) for output text explanation algorithms using Teacher Forcing technique.
  
  This class supports generation of log odds for transformer models as well as functions. In model agnostic
  cases (model is function) it expects a similarity_model and similarity_tokenizer to approximate log odd scores
  for target sentence generated by the model.
class_docstr_tok: ["Generates","scores","(","log","odds",")","for","output","text","explanation","algorithms","using","Teacher","Forcing","technique",".","This","class","supports","generation","of","log","odds","for","transformer","models","as","well","as","functions",".","In","model","agnostic","cases","(","model","is","function",")","it","expects","a","similarity_model","and","similarity_tokenizer","to","approximate","log","odd","scores","for","target","sentence","generated","by","the","model","."]
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 could be a batch of text or images(model agnostic case).
  
  Returns
  -------
  dict
      Dictionary of padded source sentence ids and attention mask as tensors("pt" or "tf" based on similarity_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","could","be","a","batch","of","text","or","images","(","model","agnostic","case",")",".","Returns","--","--","--","-","dict","Dictionary","of","padded","source","sentence","ids","and","attention","mask","as","tensors","(","``","pt","''","or","``","tf","''","based","on","similarity_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 could be a batch of text or images(model agnostic case).
  
      Returns
      -------
      dict
          Dictionary of padded source sentence ids and attention mask as tensors("pt" or "tf" based on similarity_model_type).
      """
      if self.model_agnostic:
          # In model agnostic case, we first pass the input through the model and then tokenize output sentence
          input_sentences = np.array(self.inner_model(X))
      else:
          input_sentences = np.array(X)
      # set tokenizer padding to prepare inputs for batch inferencing
      # padding_side="left" for only decoder models text generation eg. GPT2
      self.similarity_tokenizer.padding_side = padding_side
      inputs = self.similarity_tokenizer(
          input_sentences.tolist(),
          return_tensors=self.similarity_model_type,
          padding=True,
      )
      # set tokenizer padding to default
      self.similarity_tokenizer.padding_side = "right"
      return inputs
  
file_path: shap/shap/models/_teacher_forcing.py
imports: import numpy
  import scipy.special
  from ..None import models
  from .._serializable import Deserializer, Serializer
  from ..utils import safe_isinstance
  from ..utils.transformers import getattr_silent, parse_prefix_suffix_for_tokenizer
  from ._model import Model
label_desc: Use image node_id 6 for calling the TeacherForcing obj's underlying member method code with example usage: obj.get_inputs(X, padding_side) and returns: inputs