class_docstr: Language generation pipeline using any `ModelWithLMHead`. This pipeline predicts the words that will follow a
  specified text prompt.
  
  This language generation pipeline can currently be loaded from [`pipeline`] using the following task identifier:
  `"text-generation"`.
  
  The models that this pipeline can use are models that have been trained with an autoregressive language modeling
  objective, which includes the uni-directional models in the library (e.g. gpt2). See the list of available models
  on [huggingface.co/models](https://huggingface.co/models?filter=text-generation).
code: def _sanitize_parameters(
      self,
      return_full_text=None,
      return_tensors=None,
      return_text=None,
      return_type=None,
      clean_up_tokenization_spaces=None,
      prefix=None,
      handle_long_generation=None,
      stop_sequence=None,
      **generate_kwargs,
  ):
      preprocess_params = {}
      if prefix is not None:
          preprocess_params["prefix"] = prefix
      if prefix:
          prefix_inputs = self.tokenizer(
              prefix,
              padding=False,
              add_special_tokens=False,
              return_tensors=self.framework,
          )
          prefix_length = prefix_inputs["input_ids"].shape[-1]
  
          if "max_new_tokens" in generate_kwargs:
              pass
          elif "max_length" in generate_kwargs:
              generate_kwargs["max_length"] += prefix_length
          else:
              generate_kwargs["max_length"] = (
                  self.model.config.max_length + prefix_length
              )
  
          if "min_length" in generate_kwargs:
              generate_kwargs["min_length"] += prefix_length
      if handle_long_generation is not None:
          if handle_long_generation not in {"hole"}:
              raise ValueError(
                  f"{handle_long_generation} is not a valid value for `handle_long_generation` parameter expected"
                  " [None, 'hole']"
              )
          preprocess_params[
              "handle_long_generation"
          ] = handle_long_generation
  
      preprocess_params.update(generate_kwargs)
      forward_params = generate_kwargs
  
      postprocess_params = {}
      if return_full_text is not None and return_type is None:
          return_type = (
              ReturnType.FULL_TEXT
              if return_full_text
              else ReturnType.NEW_TEXT
          )
      if return_tensors is not None and return_type is None:
          return_type = ReturnType.TENSORS
      if return_type is not None:
          postprocess_params["return_type"] = return_type
      if clean_up_tokenization_spaces is not None:
          postprocess_params[
              "clean_up_tokenization_spaces"
          ] = clean_up_tokenization_spaces
  
      if stop_sequence is not None:
          stop_sequence_ids = self.tokenizer.encode(
              stop_sequence, add_special_tokens=False
          )
          if len(stop_sequence_ids) > 1:
              warnings.warn(
                  "Stopping on a multiple token sequence is not yet supported on transformers. The first token of"
                  " the stop sequence will be used as the stop sequence string in the interim."
              )
          generate_kwargs["eos_token_id"] = stop_sequence_ids[0]
  
      return preprocess_params, forward_params, postprocess_params
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/pipelines/text_generation.py
imports: import enum
  import warnings
  from transformers import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING
  from ..utils import add_end_docstrings, is_tf_available
  from .base import PIPELINE_INIT_ARGS, Pipeline
label_desc: Use image node_id 2 for calling the TextGenerationPipeline obj's underlying member method code with example usage: obj._sanitize_parameters(return_full_text, return_tensors, return_text, return_type, clean_up_tokenization_spaces, prefix, handle_long_generation, stop_sequence) and returns: preprocess_params,  forward_params,  postprocess_params