code: def test_small_model_pt_bloom_accelerate(self):
      import torch
  
      # Classic `model_kwargs`
      pipe = pipeline(
          model="hf-internal-testing/tiny-random-bloom",
          model_kwargs={
              "device_map": "auto",
              "torch_dtype": torch.bfloat16,
          },
      )
      self.assertEqual(pipe.model.device, torch.device(0))
      self.assertEqual(pipe.model.lm_head.weight.dtype, torch.bfloat16)
      out = pipe("This is a test")
      self.assertEqual(
          out,
          [
              {
                  "generated_text": (
                      "This is a test test test test test test test test test test test test test test test test"
                      " test"
                  )
              }
          ],
      )
  
      # Upgraded those two to real pipeline arguments (they just get sent for the model as they're unlikely to mean anything else.)
      pipe = pipeline(
          model="hf-internal-testing/tiny-random-bloom",
          device_map="auto",
          torch_dtype=torch.bfloat16,
      )
      self.assertEqual(pipe.model.device, torch.device(0))
      self.assertEqual(pipe.model.lm_head.weight.dtype, torch.bfloat16)
      out = pipe("This is a test")
      self.assertEqual(
          out,
          [
              {
                  "generated_text": (
                      "This is a test test test test test test test test test test test test test test test test"
                      " test"
                  )
              }
          ],
      )
  
      # torch_dtype not necessary
      pipe = pipeline(
          model="hf-internal-testing/tiny-random-bloom",
          device_map="auto",
      )
      self.assertEqual(pipe.model.device, torch.device(0))
      self.assertEqual(pipe.model.lm_head.weight.dtype, torch.bfloat16)
      out = pipe("This is a test")
      self.assertEqual(
          out,
          [
              {
                  "generated_text": (
                      "This is a test test test test test test test test test test test test test test test test"
                      " test"
                  )
              }
          ],
      )
  
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 6 for calling the TextGenerationPipelineTests obj's underlying member method code with example usage: obj.test_small_model_pt_bloom_accelerate() without return types