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 _forward(self, model_inputs, **generate_kwargs):
      input_ids = model_inputs["input_ids"]
      attention_mask = model_inputs.get("attention_mask", None)
      # Allow empty prompts
      if input_ids.shape[1] == 0:
          input_ids = None
          attention_mask = None
          in_b = 1
      else:
          in_b = input_ids.shape[0]
      prompt_text = model_inputs.pop("prompt_text")
      # BS x SL
      generated_sequence = self.model.generate(
          input_ids=input_ids,
          attention_mask=attention_mask,
          **generate_kwargs,
      )
      out_b = generated_sequence.shape[0]
      if self.framework == "pt":
          generated_sequence = generated_sequence.reshape(
              in_b, out_b // in_b, *generated_sequence.shape[1:]
          )
      elif self.framework == "tf":
          generated_sequence = tf.reshape(
              generated_sequence,
              (in_b, out_b // in_b, *generated_sequence.shape[1:]),
          )
      return {
          "generated_sequence": generated_sequence,
          "input_ids": input_ids,
          "prompt_text": prompt_text,
      }
  
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 6 for calling the TextGenerationPipeline obj's underlying member method code with example usage: obj._forward(model_inputs) and returns: dict