code: def test_small_model_pt(self):
      text_generator = pipeline(
          task="text-generation",
          model="sshleifer/tiny-ctrl",
          framework="pt",
      )
      # Using `do_sample=False` to force deterministic output
      outputs = text_generator("This is a test", do_sample=False)
      self.assertEqual(
          outputs,
          [
              {
                  "generated_text": (
                      "This is a test ☃ ☃ segmental segmental segmental 议议eski eski flutter flutter Lacy oscope."
                      " oscope. FiliFili@@"
                  )
              }
          ],
      )
  
      outputs = text_generator(
          ["This is a test", "This is a second test"]
      )
      self.assertEqual(
          outputs,
          [
              [
                  {
                      "generated_text": (
                          "This is a test ☃ ☃ segmental segmental segmental 议议eski eski flutter flutter Lacy oscope."
                          " oscope. FiliFili@@"
                      )
                  }
              ],
              [
                  {
                      "generated_text": (
                          "This is a second test ☃ segmental segmental segmental 议议eski eski flutter flutter Lacy"
                          " oscope. oscope. FiliFili@@"
                      )
                  }
              ],
          ],
      )
  
      outputs = text_generator(
          "This is a test",
          do_sample=True,
          num_return_sequences=2,
          return_tensors=True,
      )
      self.assertEqual(
          outputs,
          [
              {"generated_token_ids": ANY(list)},
              {"generated_token_ids": ANY(list)},
          ],
      )
      text_generator.tokenizer.pad_token_id = (
          text_generator.model.config.eos_token_id
      )
      text_generator.tokenizer.pad_token = "<pad>"
      outputs = text_generator(
          ["This is a test", "This is a second test"],
          do_sample=True,
          num_return_sequences=2,
          batch_size=2,
          return_tensors=True,
      )
      self.assertEqual(
          outputs,
          [
              [
                  {"generated_token_ids": ANY(list)},
                  {"generated_token_ids": ANY(list)},
              ],
              [
                  {"generated_token_ids": ANY(list)},
                  {"generated_token_ids": ANY(list)},
              ],
          ],
      )
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/tests/pipelines/test_pipelines_text_generation.py
imports: import unittest
  from transformers import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, pipeline
  from transformers.testing_utils import require_accelerate, require_tf, require_torch, require_torch_gpu, require_torch_or_tf
  from .test_pipelines_common import ANY, PipelineTestCaseMeta
label_desc: Use image node_id 1 for calling the TextGenerationPipelineTests obj's underlying member method code with example usage: obj.test_small_model_pt() without return types