class_docstr: Pipeline for text-to-audio generation using AudioLDM2.
  
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods
  implemented for all pipelines (downloading, saving, running on a particular device, etc.).
  
  Args:
      vae ([`AutoencoderKL`]):
          Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.
      text_encoder ([`~transformers.ClapModel`]):
          First frozen text-encoder. AudioLDM2 uses the joint audio-text embedding model
          [CLAP](https://huggingface.co/docs/transformers/model_doc/clap#transformers.CLAPTextModelWithProjection),
          specifically the [laion/clap-htsat-unfused](https://huggingface.co/laion/clap-htsat-unfused) variant. The
          text branch is used to encode the text prompt to a prompt embedding. The full audio-text model is used to
          rank generated waveforms against the text prompt by computing similarity scores.
      text_encoder_2 ([`~transformers.T5EncoderModel`]):
          Second frozen text-encoder. AudioLDM2 uses the encoder of
          [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel), specifically the
          [google/flan-t5-large](https://huggingface.co/google/flan-t5-large) variant.
      projection_model ([`AudioLDM2ProjectionModel`]):
          A trained model used to linearly project the hidden-states from the first and second text encoder models
          and insert learned SOS and EOS token embeddings. The projected hidden-states from the two text encoders are
          concatenated to give the input to the language model.
      language_model ([`~transformers.GPT2Model`]):
          An auto-regressive language model used to generate a sequence of hidden-states conditioned on the projected
          outputs from the two text encoders.
      tokenizer ([`~transformers.RobertaTokenizer`]):
          Tokenizer to tokenize text for the first frozen text-encoder.
      tokenizer_2 ([`~transformers.T5Tokenizer`]):
          Tokenizer to tokenize text for the second frozen text-encoder.
      feature_extractor ([`~transformers.ClapFeatureExtractor`]):
          Feature extractor to pre-process generated audio waveforms to log-mel spectrograms for automatic scoring.
      unet ([`UNet2DConditionModel`]):
          A `UNet2DConditionModel` to denoise the encoded audio latents.
      scheduler ([`SchedulerMixin`]):
          A scheduler to be used in combination with `unet` to denoise the encoded audio latents. Can be one of
          [`DDIMScheduler`], [`LMSDiscreteScheduler`], or [`PNDMScheduler`].
      vocoder ([`~transformers.SpeechT5HifiGan`]):
          Vocoder of class `SpeechT5HifiGan` to convert the mel-spectrogram latents to the final audio waveform.
class_docstr_tok: ["Pipeline","for","text-to-audio","generation","using","AudioLDM2",".","This","model","inherits","from","[","`","DiffusionPipeline","`","]",".","Check","the","superclass","documentation","for","the","generic","methods","implemented","for","all","pipelines","(","downloading",",","saving",",","running","on","a","particular","device",",","etc.",")",".","Args",":","vae","(","[","`","AutoencoderKL","`","]",")",":","Variational","Auto-Encoder","(","VAE",")","model","to","encode","and","decode","images","to","and","from","latent","representations",".","text_encoder","(","[","`","~transformers.ClapModel","`","]",")",":","First","frozen","text-encoder",".","AudioLDM2","uses","the","joint","audio-text","embedding","model","[","CLAP","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/model_doc\/clap","#","transformers.CLAPTextModelWithProjection",")",",","specifically","the","[","laion\/clap-htsat-unfused","]","(","https",":","\/\/huggingface.co\/laion\/clap-htsat-unfused",")","variant",".","The","text","branch","is","used","to","encode","the","text","prompt","to","a","prompt","embedding",".","The","full","audio-text","model","is","used","to","rank","generated","waveforms","against","the","text","prompt","by","computing","similarity","scores",".","text_encoder_2","(","[","`","~transformers.T5EncoderModel","`","]",")",":","Second","frozen","text-encoder",".","AudioLDM2","uses","the","encoder","of","[","T5","]","(","https",":","\/\/huggingface.co\/docs\/transformers\/model_doc\/t5","#","transformers.T5EncoderModel",")",",","specifically","the","[","google\/flan-t5-large","]","(","https",":","\/\/huggingface.co\/google\/flan-t5-large",")","variant",".","projection_model","(","[","`","AudioLDM2ProjectionModel","`","]",")",":","A","trained","model","used","to","linearly","project","the","hidden-states","from","the","first","and","second","text","encoder","models","and","insert","learned","SOS","and","EOS","token","embeddings",".","The","projected","hidden-states","from","the","two","text","encoders","are","concatenated","to","give","the","input","to","the","language","model",".","language_model","(","[","`","~transformers.GPT2Model","`","]",")",":","An","auto-regressive","language","model","used","to","generate","a","sequence","of","hidden-states","conditioned","on","the","projected","outputs","from","the","two","text","encoders",".","tokenizer","(","[","`","~transformers.RobertaTokenizer","`","]",")",":","Tokenizer","to","tokenize","text","for","the","first","frozen","text-encoder",".","tokenizer_2","(","[","`","~transformers.T5Tokenizer","`","]",")",":","Tokenizer","to","tokenize","text","for","the","second","frozen","text-encoder",".","feature_extractor","(","[","`","~transformers.ClapFeatureExtractor","`","]",")",":","Feature","extractor","to","pre-process","generated","audio","waveforms","to","log-mel","spectrograms","for","automatic","scoring",".","unet","(","[","`","UNet2DConditionModel","`","]",")",":","A","`","UNet2DConditionModel","`","to","denoise","the","encoded","audio","latents",".","scheduler","(","[","`","SchedulerMixin","`","]",")",":","A","scheduler","to","be","used","in","combination","with","`","unet","`","to","denoise","the","encoded","audio","latents",".","Can","be","one","of","[","`","DDIMScheduler","`","]",",","[","`","LMSDiscreteScheduler","`","]",",","or","[","`","PNDMScheduler","`","]",".","vocoder","(","[","`","~transformers.SpeechT5HifiGan","`","]",")",":","Vocoder","of","class","`","SpeechT5HifiGan","`","to","convert","the","mel-spectrogram","latents","to","the","final","audio","waveform","."]
code: def check_inputs(
      self,
      prompt,
      audio_length_in_s,
      vocoder_upsample_factor,
      callback_steps,
      negative_prompt=None,
      prompt_embeds=None,
      negative_prompt_embeds=None,
      generated_prompt_embeds=None,
      negative_generated_prompt_embeds=None,
      attention_mask=None,
      negative_attention_mask=None,
  ):
      min_audio_length_in_s = (
          vocoder_upsample_factor * self.vae_scale_factor
      )
      if audio_length_in_s < min_audio_length_in_s:
          raise ValueError(
              f"`audio_length_in_s` has to be a positive value greater than or equal to {min_audio_length_in_s}, but "
              f"is {audio_length_in_s}."
          )
  
      if self.vocoder.config.model_in_dim % self.vae_scale_factor != 0:
          raise ValueError(
              f"The number of frequency bins in the vocoder's log-mel spectrogram has to be divisible by the "
              f"VAE scale factor, but got {self.vocoder.config.model_in_dim} bins and a scale factor of "
              f"{self.vae_scale_factor}."
          )
  
      if (callback_steps is None) or (
          callback_steps is not None
          and (
              not isinstance(callback_steps, int) or callback_steps <= 0
          )
      ):
          raise ValueError(
              f"`callback_steps` has to be a positive integer but is {callback_steps} of type"
              f" {type(callback_steps)}."
          )
  
      if prompt is not None and prompt_embeds is not None:
          raise ValueError(
              f"Cannot forward both `prompt`: {prompt} and `prompt_embeds`: {prompt_embeds}. Please make sure to"
              " only forward one of the two."
          )
      elif prompt is None and (
          prompt_embeds is None or generated_prompt_embeds is None
      ):
          raise ValueError(
              "Provide either `prompt`, or `prompt_embeds` and `generated_prompt_embeds`. Cannot leave "
              "`prompt` undefined without specifying both `prompt_embeds` and `generated_prompt_embeds`."
          )
      elif prompt is not None and (
          not isinstance(prompt, str) and not isinstance(prompt, list)
      ):
          raise ValueError(
              f"`prompt` has to be of type `str` or `list` but is {type(prompt)}"
          )
  
      if (
          negative_prompt is not None
          and negative_prompt_embeds is not None
      ):
          raise ValueError(
              f"Cannot forward both `negative_prompt`: {negative_prompt} and `negative_prompt_embeds`:"
              f" {negative_prompt_embeds}. Please make sure to only forward one of the two."
          )
      elif (
          negative_prompt_embeds is not None
          and negative_generated_prompt_embeds is None
      ):
          raise ValueError(
              "Cannot forward `negative_prompt_embeds` without `negative_generated_prompt_embeds`. Ensure that"
              "both arguments are specified"
          )
  
      if (
          prompt_embeds is not None
          and negative_prompt_embeds is not None
      ):
          if prompt_embeds.shape != negative_prompt_embeds.shape:
              raise ValueError(
                  "`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but"
                  f" got: `prompt_embeds` {prompt_embeds.shape} != `negative_prompt_embeds`"
                  f" {negative_prompt_embeds.shape}."
              )
          if (
              attention_mask is not None
              and attention_mask.shape != prompt_embeds.shape[:2]
          ):
              raise ValueError(
                  "`attention_mask should have the same batch size and sequence length as `prompt_embeds`, but got:"
                  f"`attention_mask: {attention_mask.shape} != `prompt_embeds` {prompt_embeds.shape}"
              )
  
      if (
          generated_prompt_embeds is not None
          and negative_generated_prompt_embeds is not None
      ):
          if (
              generated_prompt_embeds.shape
              != negative_generated_prompt_embeds.shape
          ):
              raise ValueError(
                  "`generated_prompt_embeds` and `negative_generated_prompt_embeds` must have the same shape when "
                  f"passed directly, but got: `generated_prompt_embeds` {generated_prompt_embeds.shape} != "
                  f"`negative_generated_prompt_embeds` {negative_generated_prompt_embeds.shape}."
              )
          if (
              negative_attention_mask is not None
              and negative_attention_mask.shape
              != negative_prompt_embeds.shape[:2]
          ):
              raise ValueError(
                  "`attention_mask should have the same batch size and sequence length as `prompt_embeds`, but got:"
                  f"`attention_mask: {negative_attention_mask.shape} != `prompt_embeds` {negative_prompt_embeds.shape}"
              )
  
imports: import inspect
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import torch
  from transformers import ClapFeatureExtractor, ClapModel, GPT2Model, RobertaTokenizer, RobertaTokenizerFast, SpeechT5HifiGan, T5EncoderModel, T5Tokenizer, T5TokenizerFast
  from ...models import AutoencoderKL
  from ...schedulers import KarrasDiffusionSchedulers
  from ...utils import is_accelerate_available, is_accelerate_version, is_librosa_available, logging, replace_example_docstring
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
  from .modeling_audioldm2 import AudioLDM2ProjectionModel, AudioLDM2UNet2DConditionModel
label_desc: Use image node_id 10 for calling the AudioLDM2Pipeline obj's underlying member method code with example usage: obj.check_inputs(prompt, audio_length_in_s, vocoder_upsample_factor, callback_steps, negative_prompt, prompt_embeds, negative_prompt_embeds, generated_prompt_embeds, negative_generated_prompt_embeds, attention_mask, negative_attention_mask) without return types