code: def test_small_bark_pt(self):
      speech_generator = pipeline(
          task="text-to-audio", model="suno/bark-small", framework="pt"
      )
  
      forward_params = {
          # Using `do_sample=False` to force deterministic output
          "do_sample": False,
          "semantic_max_new_tokens": 100,
      }
  
      outputs = speech_generator(
          "This is a test", forward_params=forward_params
      )
      self.assertEqual(
          {"audio": ANY(np.ndarray), "sampling_rate": 24000},
          outputs,
      )
  
      # test two examples side-by-side
      outputs = speech_generator(
          ["This is a test", "This is a second test"],
          forward_params=forward_params,
      )
      audio = [output["audio"] for output in outputs]
      self.assertEqual([ANY(np.ndarray), ANY(np.ndarray)], audio)
  
      # test other generation strategy
      forward_params = {
          "do_sample": True,
          "semantic_max_new_tokens": 100,
          "semantic_num_return_sequences": 2,
      }
  
      outputs = speech_generator(
          "This is a test", forward_params=forward_params
      )
      audio = outputs["audio"]
      self.assertEqual(ANY(np.ndarray), audio)
  
      # test using a speaker embedding
      processor = AutoProcessor.from_pretrained("suno/bark-small")
      temp_inp = processor(
          "hey, how are you?", voice_preset="v2/en_speaker_5"
      )
      history_prompt = temp_inp["history_prompt"]
      forward_params["history_prompt"] = history_prompt
  
      outputs = speech_generator(
          ["This is a test", "This is a second test"],
          forward_params=forward_params,
          batch_size=2,
      )
      audio = [output["audio"] for output in outputs]
      self.assertEqual([ANY(np.ndarray), ANY(np.ndarray)], audio)
  
file_path: transformers/tests/pipelines/test_pipelines_text_to_audio.py
imports: import unittest
  import numpy
  from transformers import MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING, AutoProcessor, TextToAudioPipeline, pipeline
  from transformers.testing_utils import is_pipeline_test, require_torch, require_torch_accelerator, require_torch_or_tf, slow, torch_device
  from transformers.trainer_utils import set_seed
  from .test_pipelines_common import ANY
label_desc: Use image node_id 2 for calling the TextToAudioPipelineTests obj's underlying member method code with example usage: obj.test_small_bark_pt() without return types