import{s as et,o as tt,n as nt}from"../chunks/scheduler.53228c21.js";import{S as at,i as ot,e as i,s as o,c as f,h as st,a as l,d as n,b as s,f as te,g as h,j as m,k as ne,l as d,m as a,n as g,t as b,o as _,p as y}from"../chunks/index.100fac89.js";import{C as it}from"../chunks/CopyLLMTxtMenu.0ee1b69b.js";import{D as Ue}from"../chunks/Docstring.db856a1e.js";import{C as Ke}from"../chunks/CodeBlock.d30a6509.js";import{E as lt}from"../chunks/ExampleCodeBlock.3eb26ae1.js";import{H as xe,E as rt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function dt(oe){let p,C="Examples:",v,w,M;return w=new Ke({props:{code:"aW1wb3J0JTIwc2NpcHklMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMHNvdW5kZmlsZSUyMGFzJTIwc2YlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlQXVkaW9QaXBlbGluZSUwQSUwQXJlcG9faWQlMjAlM0QlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1hdWRpby1vcGVuLTEuMCUyMiUwQXBpcGUlMjAlM0QlMjBTdGFibGVBdWRpb1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBJTIzJTIwZGVmaW5lJTIwdGhlJTIwcHJvbXB0cyUwQXByb21wdCUyMCUzRCUyMCUyMlRoZSUyMHNvdW5kJTIwb2YlMjBhJTIwaGFtbWVyJTIwaGl0dGluZyUyMGElMjB3b29kZW4lMjBzdXJmYWNlLiUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMkxvdyUyMHF1YWxpdHkuJTIyJTBBJTBBJTIzJTIwc2V0JTIwdGhlJTIwc2VlZCUyMGZvciUyMGdlbmVyYXRvciUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvciglMjJjdWRhJTIyKS5tYW51YWxfc2VlZCgwKSUwQSUwQSUyMyUyMHJ1biUyMHRoZSUyMGdlbmVyYXRpb24lMEFhdWRpbyUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwMCUyQyUwQSUyMCUyMCUyMCUyMGF1ZGlvX2VuZF9pbl9zJTNEMTAuMCUyQyUwQSUyMCUyMCUyMCUyMG51bV93YXZlZm9ybXNfcGVyX3Byb21wdCUzRDMlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEEpLmF1ZGlvcyUwQSUwQW91dHB1dCUyMCUzRCUyMGF1ZGlvJTVCMCU1RC5ULmZsb2F0KCkuY3B1KCkubnVtcHkoKSUwQXNmLndyaXRlKCUyMmhhbW1lci53YXYlMjIlMkMlMjBvdXRwdXQlMkMlMjBwaXBlLnZhZS5zYW1wbGluZ19yYXRlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> scipy
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> soundfile <span class="hljs-keyword">as</span> sf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableAudioPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>repo_id = <span class="hljs-string">&quot;stabilityai/stable-audio-open-1.0&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableAudioPipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># define the prompts</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;The sound of a hammer hitting a wooden surface.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_prompt = <span class="hljs-string">&quot;Low quality.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># set the seed for generator</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = torch.Generator(<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># run the generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>audio = pipe(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    negative_prompt=negative_prompt,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">200</span>,
<span class="hljs-meta">... </span>    audio_end_in_s=<span class="hljs-number">10.0</span>,
<span class="hljs-meta">... </span>    num_waveforms_per_prompt=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    generator=generator,
<span class="hljs-meta">... </span>).audios

<span class="hljs-meta">&gt;&gt;&gt; </span>output = audio[<span class="hljs-number">0</span>].T.<span class="hljs-built_in">float</span>().cpu().numpy()
<span class="hljs-meta">&gt;&gt;&gt; </span>sf.write(<span class="hljs-string">&quot;hammer.wav&quot;</span>, output, pipe.vae.sampling_rate)`,wrap:!1}}),{c(){p=i("p"),p.textContent=C,v=o(),f(w.$$.fragment)},l(r){p=l(r,"P",{"data-svelte-h":!0}),m(p)!=="svelte-kvfsh7"&&(p.textContent=C),v=s(r),h(w.$$.fragment,r)},m(r,T){a(r,p,T),a(r,v,T),g(w,r,T),M=!0},p:nt,i(r){M||(b(w.$$.fragment,r),M=!0)},o(r){_(w.$$.fragment,r),M=!1},d(r){r&&(n(p),n(v)),y(w,r)}}}function pt(oe){let p,C,v,w,M,r,T,se,k,Xe='Stable Audio was proposed in <a href="https://huggingface.co/papers/2407.14358" rel="nofollow">Stable Audio Open</a> by Zach Evans et al. . it takes a text prompt as input and predicts the corresponding sound or music sample.',ie,B,Ge="Stable Audio Open generates variable-length (up to 47s) stereo audio at 44.1kHz from text prompts. It comprises three components: an autoencoder that compresses waveforms into a manageable sequence length, a T5-based text embedding for text conditioning, and a transformer-based diffusion (DiT) model that operates in the latent space of the autoencoder.",le,S,Pe="Stable Audio is trained on a corpus of around 48k audio recordings, where around 47k are from Freesound and the rest are from the Free Music Archive (FMA). All audio files are licensed under CC0, CC BY, or CC Sampling+. This data is used to train the autoencoder and the DiT.",re,A,Re=`The abstract of the paper is the following:
<em>Open generative models are vitally important for the community, allowing for fine-tunes and serving as baselines when presenting new models. However, most current text-to-audio models are private and not accessible for artists and researchers to build upon. Here we describe the architecture and training process of a new open-weights text-to-audio model trained with Creative Commons data. Our evaluation shows that the model’s performance is competitive with the state-of-the-art across various metrics. Notably, the reported FDopenl3 results (measuring the realism of the generations) showcase its potential for high-quality stereo sound synthesis at 44.1kHz.</em>`,de,I,Ee='This pipeline was contributed by <a href="https://huggingface.co/ylacombe" rel="nofollow">Yoach Lacombe</a>. The original codebase can be found at <a href="https://github.com/Stability-AI/stable-audio-tools" rel="nofollow">Stability-AI/stable-audio-tools</a>.',pe,Z,ce,$,Ve="When constructing a prompt, keep in mind:",me,W,Qe="<li>Descriptive prompt inputs work best; use adjectives to describe the sound (for example, “high quality” or “clear”) and make the prompt context specific where possible (e.g. “melodic techno with a fast beat and synths” works better than “techno”).</li> <li>Using a <em>negative prompt</em> can significantly improve the quality of the generated audio. Try using a negative prompt of “low quality, average quality”.</li>",ue,X,ze="During inference:",fe,G,He="<li>The <em>quality</em> of the generated audio sample can be controlled by the <code>num_inference_steps</code> argument; higher steps give higher quality audio at the expense of slower inference.</li> <li>Multiple waveforms can be generated in one go: set <code>num_waveforms_per_prompt</code> to a value greater than 1 to enable. Automatic scoring will be performed between the generated waveforms and prompt text, and the audios ranked from best to worst accordingly.</li>",he,P,ge,R,qe="Quantization helps reduce the memory requirements of very large models by storing model weights in a lower precision data type. However, quantization may have varying impact on video quality depending on the video model.",be,E,Ne='Refer to the <a href="../../quantization/overview">Quantization</a> overview to learn more about supported quantization backends and selecting a quantization backend that supports your use case. The example below demonstrates how to load a quantized <a href="/docs/diffusers/main/en/api/pipelines/stable_audio#diffusers.StableAudioPipeline">StableAudioPipeline</a> for inference with bitsandbytes.',_e,V,ye,Q,we,c,z,Ce,Y,De="Pipeline for text-to-audio generation using StableAudio.",ke,L,Ye=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Be,J,H,Se,F,Le="The call function to the pipeline for generation.",Ae,j,Ie,U,q,Ze,O,Fe=`Disable sliced VAE decoding. If <code>enable_vae_slicing</code> was previously enabled, this method will go back to
computing decoding in one step.`,$e,x,N,We,K,Oe=`Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.`,Me,D,Te,ae,ve;return M=new it({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new xe({props:{title:"Stable Audio",local:"stable-audio",headingTag:"h1"}}),Z=new xe({props:{title:"Tips",local:"tips",headingTag:"h2"}}),P=new xe({props:{title:"Quantization",local:"quantization",headingTag:"h2"}}),V=new Ke({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQml0c0FuZEJ5dGVzQ29uZmlnJTIwYXMlMjBEaWZmdXNlcnNCaXRzQW5kQnl0ZXNDb25maWclMkMlMjBTdGFibGVBdWRpb0RpVE1vZGVsJTJDJTIwU3RhYmxlQXVkaW9Qa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TNEJTIwYXVkaW8lNUIwJTVELlQuZmxvYXQoKS5jcHUoKS5udW1weSgpJTBBc2Yud3JpdGUoJTIyaGFtbWVyLndhdiUyMiUyQyUyMG91dHB1dCUyQyUyMHBpcGVsaW5lLnZhZS5zYW1wbGluZ19yYXRlKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BitsAndBytesConfig <span class="hljs-keyword">as</span> DiffusersBitsAndBytesConfig, StableAudioDiTModel, StableAudioPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig <span class="hljs-keyword">as</span> BitsAndBytesConfig, T5EncoderModel

quant_config = BitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>)
text_encoder_8bit = T5EncoderModel.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-audio-open-1.0&quot;</span>,
    subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>,
    quantization_config=quant_config,
    torch_dtype=torch.float16,
)

quant_config = DiffusersBitsAndBytesConfig(load_in_8bit=<span class="hljs-literal">True</span>)
transformer_8bit = StableAudioDiTModel.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-audio-open-1.0&quot;</span>,
    subfolder=<span class="hljs-string">&quot;transformer&quot;</span>,
    quantization_config=quant_config,
    torch_dtype=torch.float16,
)

pipeline = StableAudioPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-audio-open-1.0&quot;</span>,
    text_encoder=text_encoder_8bit,
    transformer=transformer_8bit,
    torch_dtype=torch.float16,
    device_map=<span class="hljs-string">&quot;balanced&quot;</span>,
)

prompt = <span class="hljs-string">&quot;The sound of a hammer hitting a wooden surface.&quot;</span>
negative_prompt = <span class="hljs-string">&quot;Low quality.&quot;</span>
audio = pipeline(
    prompt,
    negative_prompt=negative_prompt,
    num_inference_steps=<span class="hljs-number">200</span>,
    audio_end_in_s=<span class="hljs-number">10.0</span>,
    num_waveforms_per_prompt=<span class="hljs-number">3</span>,
    generator=generator,
).audios

output = audio[<span class="hljs-number">0</span>].T.<span class="hljs-built_in">float</span>().cpu().numpy()
sf.write(<span class="hljs-string">&quot;hammer.wav&quot;</span>, output, pipeline.vae.sampling_rate)`,wrap:!1}}),Q=new xe({props:{title:"StableAudioPipeline",local:"diffusers.StableAudioPipeline",headingTag:"h2"}}),z=new Ue({props:{name:"class diffusers.StableAudioPipeline",anchor:"diffusers.StableAudioPipeline",parameters:[{name:"vae",val:": AutoencoderOobleck"},{name:"text_encoder",val:": T5EncoderModel"},{name:"projection_model",val:": StableAudioProjectionModel"},{name:"tokenizer",val:": typing.Union[transformers.models.t5.tokenization_t5.T5Tokenizer, transformers.models.t5.tokenization_t5_fast.T5TokenizerFast]"},{name:"transformer",val:": StableAudioDiTModel"},{name:"scheduler",val:": EDMDPMSolverMultistepScheduler"}],parametersDescription:[{anchor:"diffusers.StableAudioPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoder_oobleck#diffusers.AutoencoderOobleck">AutoencoderOobleck</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableAudioPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5EncoderModel</a>) &#x2014;
Frozen text-encoder. StableAudio uses the encoder of
<a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically the
<a href="https://huggingface.co/google-t5/t5-base" rel="nofollow">google-t5/t5-base</a> variant.`,name:"text_encoder"},{anchor:"diffusers.StableAudioPipeline.projection_model",description:`<strong>projection_model</strong> (<code>StableAudioProjectionModel</code>) &#x2014;
A trained model used to linearly project the hidden-states from the text encoder model and the start and
end seconds. The projected hidden-states from the encoder and the conditional seconds are concatenated to
give the input to the transformer model.`,name:"projection_model"},{anchor:"diffusers.StableAudioPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5Tokenizer</a>) &#x2014;
Tokenizer to tokenize text for the frozen text-encoder.`,name:"tokenizer"},{anchor:"diffusers.StableAudioPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/main/en/api/models/stable_audio_transformer#diffusers.StableAudioDiTModel">StableAudioDiTModel</a>) &#x2014;
A <code>StableAudioDiTModel</code> to denoise the encoded audio latents.`,name:"transformer"},{anchor:"diffusers.StableAudioPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/edm_multistep_dpm_solver#diffusers.EDMDPMSolverMultistepScheduler">EDMDPMSolverMultistepScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded audio latents.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_audio/pipeline_stable_audio.py#L78"}}),H=new Ue({props:{name:"__call__",anchor:"diffusers.StableAudioPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"audio_end_in_s",val:": typing.Optional[float] = None"},{name:"audio_start_in_s",val:": typing.Optional[float] = 0.0"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 7.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_waveforms_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"initial_audio_waveforms",val:": typing.Optional[torch.Tensor] = None"},{name:"initial_audio_sampling_rate",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"negative_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Optional[typing.Callable[[int, int, torch.Tensor], NoneType]] = None"},{name:"callback_steps",val:": typing.Optional[int] = 1"},{name:"output_type",val:": typing.Optional[str] = 'pt'"}],parametersDescription:[{anchor:"diffusers.StableAudioPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide audio generation. If not defined, you need to pass <code>prompt_embeds</code>.`,name:"prompt"},{anchor:"diffusers.StableAudioPipeline.__call__.audio_end_in_s",description:`<strong>audio_end_in_s</strong> (<code>float</code>, <em>optional</em>, defaults to 47.55) &#x2014;
Audio end index in seconds.`,name:"audio_end_in_s"},{anchor:"diffusers.StableAudioPipeline.__call__.audio_start_in_s",description:`<strong>audio_start_in_s</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
Audio start index in seconds.`,name:"audio_start_in_s"},{anchor:"diffusers.StableAudioPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality audio at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.StableAudioPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.0) &#x2014;
A higher guidance scale value encourages the model to generate audio that is closely linked to the text
<code>prompt</code> at the expense of lower sound quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.StableAudioPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide what to not include in audio generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableAudioPipeline.__call__.num_waveforms_per_prompt",description:`<strong>num_waveforms_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of waveforms to generate per prompt.`,name:"num_waveforms_per_prompt"},{anchor:"diffusers.StableAudioPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://huggingface.co/papers/2010.02502" rel="nofollow">DDIM</a> paper. Only
applies to the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.StableAudioPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.StableAudioPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for audio
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableAudioPipeline.__call__.initial_audio_waveforms",description:`<strong>initial_audio_waveforms</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Optional initial audio waveforms to use as the initial audio waveform for generation. Must be of shape
<code>(batch_size, num_channels, audio_length)</code> or <code>(batch_size, audio_length)</code>, where <code>batch_size</code>
corresponds to the number of prompts passed to the model.`,name:"initial_audio_waveforms"},{anchor:"diffusers.StableAudioPipeline.__call__.initial_audio_sampling_rate",description:`<strong>initial_audio_sampling_rate</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Sampling rate of the <code>initial_audio_waveforms</code>, if they are provided. Must be the same as the model.`,name:"initial_audio_sampling_rate"},{anchor:"diffusers.StableAudioPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-computed text embeddings from the text encoder model. Can be used to easily tweak text inputs,
<em>e.g.</em> prompt weighting. If not provided, text embeddings will be computed from <code>prompt</code> input
argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableAudioPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-computed negative text embeddings from the text encoder model. Can be used to easily tweak text
inputs, <em>e.g.</em> prompt weighting. If not provided, negative_prompt_embeds will be computed from
<code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableAudioPipeline.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-computed attention mask to be applied to the <code>prompt_embeds</code>. If not provided, attention mask will
be computed from <code>prompt</code> input argument.`,name:"attention_mask"},{anchor:"diffusers.StableAudioPipeline.__call__.negative_attention_mask",description:`<strong>negative_attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-computed attention mask to be applied to the <code>negative_text_audio_duration_embeds</code>.`,name:"negative_attention_mask"},{anchor:"diffusers.StableAudioPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableAudioPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls every <code>callback_steps</code> steps during inference. The function is called with the
following arguments: <code>callback(step: int, timestep: int, latents: torch.Tensor)</code>.`,name:"callback"},{anchor:"diffusers.StableAudioPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function is called. If not specified, the callback is called at
every step.`,name:"callback_steps"},{anchor:"diffusers.StableAudioPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pt&quot;</code>) &#x2014;
The output format of the generated audio. Choose between <code>&quot;np&quot;</code> to return a NumPy <code>np.ndarray</code> or
<code>&quot;pt&quot;</code> to return a PyTorch <code>torch.Tensor</code> object. Set to <code>&quot;latent&quot;</code> to return the latent diffusion
model (LDM) output.`,name:"output_type"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_audio/pipeline_stable_audio.py#L490",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where the first element is a list with the generated audio.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),j=new lt({props:{anchor:"diffusers.StableAudioPipeline.__call__.example",$$slots:{default:[dt]},$$scope:{ctx:oe}}}),q=new Ue({props:{name:"disable_vae_slicing",anchor:"diffusers.StableAudioPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_audio/pipeline_stable_audio.py#L142"}}),N=new Ue({props:{name:"enable_vae_slicing",anchor:"diffusers.StableAudioPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_audio/pipeline_stable_audio.py#L128"}}),D=new rt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/stable_audio.md"}}),{c(){p=i("meta"),C=o(),v=i("p"),w=o(),f(M.$$.fragment),r=o(),f(T.$$.fragment),se=o(),k=i("p"),k.innerHTML=Xe,ie=o(),B=i("p"),B.textContent=Ge,le=o(),S=i("p"),S.textContent=Pe,re=o(),A=i("p"),A.innerHTML=Re,de=o(),I=i("p"),I.innerHTML=Ee,pe=o(),f(Z.$$.fragment),ce=o(),$=i("p"),$.textContent=Ve,me=o(),W=i("ul"),W.innerHTML=Qe,ue=o(),X=i("p"),X.textContent=ze,fe=o(),G=i("ul"),G.innerHTML=He,he=o(),f(P.$$.fragment),ge=o(),R=i("p"),R.textContent=qe,be=o(),E=i("p"),E.innerHTML=Ne,_e=o(),f(V.$$.fragment),ye=o(),f(Q.$$.fragment),we=o(),c=i("div"),f(z.$$.fragment),Ce=o(),Y=i("p"),Y.textContent=De,ke=o(),L=i("p"),L.innerHTML=Ye,Be=o(),J=i("div"),f(H.$$.fragment),Se=o(),F=i("p"),F.textContent=Le,Ae=o(),f(j.$$.fragment),Ie=o(),U=i("div"),f(q.$$.fragment),Ze=o(),O=i("p"),O.innerHTML=Fe,$e=o(),x=i("div"),f(N.$$.fragment),We=o(),K=i("p"),K.textContent=Oe,Me=o(),f(D.$$.fragment),Te=o(),ae=i("p"),this.h()},l(e){const t=st("svelte-u9bgzb",document.head);p=l(t,"META",{name:!0,content:!0}),t.forEach(n),C=s(e),v=l(e,"P",{}),te(v).forEach(n),w=s(e),h(M.$$.fragment,e),r=s(e),h(T.$$.fragment,e),se=s(e),k=l(e,"P",{"data-svelte-h":!0}),m(k)!=="svelte-wlprt6"&&(k.innerHTML=Xe),ie=s(e),B=l(e,"P",{"data-svelte-h":!0}),m(B)!=="svelte-1fkqtr3"&&(B.textContent=Ge),le=s(e),S=l(e,"P",{"data-svelte-h":!0}),m(S)!=="svelte-1di6p47"&&(S.textContent=Pe),re=s(e),A=l(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-lksd8b"&&(A.innerHTML=Re),de=s(e),I=l(e,"P",{"data-svelte-h":!0}),m(I)!=="svelte-1kn7isa"&&(I.innerHTML=Ee),pe=s(e),h(Z.$$.fragment,e),ce=s(e),$=l(e,"P",{"data-svelte-h":!0}),m($)!=="svelte-1dvtu0c"&&($.textContent=Ve),me=s(e),W=l(e,"UL",{"data-svelte-h":!0}),m(W)!=="svelte-1gnv7ni"&&(W.innerHTML=Qe),ue=s(e),X=l(e,"P",{"data-svelte-h":!0}),m(X)!=="svelte-1g0t9wk"&&(X.textContent=ze),fe=s(e),G=l(e,"UL",{"data-svelte-h":!0}),m(G)!=="svelte-1xz0ikc"&&(G.innerHTML=He),he=s(e),h(P.$$.fragment,e),ge=s(e),R=l(e,"P",{"data-svelte-h":!0}),m(R)!=="svelte-1ou2pxc"&&(R.textContent=qe),be=s(e),E=l(e,"P",{"data-svelte-h":!0}),m(E)!=="svelte-3clkii"&&(E.innerHTML=Ne),_e=s(e),h(V.$$.fragment,e),ye=s(e),h(Q.$$.fragment,e),we=s(e),c=l(e,"DIV",{class:!0});var u=te(c);h(z.$$.fragment,u),Ce=s(u),Y=l(u,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-vd0h2c"&&(Y.textContent=De),ke=s(u),L=l(u,"P",{"data-svelte-h":!0}),m(L)!=="svelte-496sm0"&&(L.innerHTML=Ye),Be=s(u),J=l(u,"DIV",{class:!0});var ee=te(J);h(H.$$.fragment,ee),Se=s(ee),F=l(ee,"P",{"data-svelte-h":!0}),m(F)!=="svelte-50j04k"&&(F.textContent=Le),Ae=s(ee),h(j.$$.fragment,ee),ee.forEach(n),Ie=s(u),U=l(u,"DIV",{class:!0});var Je=te(U);h(q.$$.fragment,Je),Ze=s(Je),O=l(Je,"P",{"data-svelte-h":!0}),m(O)!=="svelte-1s3c06i"&&(O.innerHTML=Fe),Je.forEach(n),$e=s(u),x=l(u,"DIV",{class:!0});var je=te(x);h(N.$$.fragment,je),We=s(je),K=l(je,"P",{"data-svelte-h":!0}),m(K)!=="svelte-14bnrb6"&&(K.textContent=Oe),je.forEach(n),u.forEach(n),Me=s(e),h(D.$$.fragment,e),Te=s(e),ae=l(e,"P",{}),te(ae).forEach(n),this.h()},h(){ne(p,"name","hf:doc:metadata"),ne(p,"content",ct),ne(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),ne(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),ne(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),ne(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){d(document.head,p),a(e,C,t),a(e,v,t),a(e,w,t),g(M,e,t),a(e,r,t),g(T,e,t),a(e,se,t),a(e,k,t),a(e,ie,t),a(e,B,t),a(e,le,t),a(e,S,t),a(e,re,t),a(e,A,t),a(e,de,t),a(e,I,t),a(e,pe,t),g(Z,e,t),a(e,ce,t),a(e,$,t),a(e,me,t),a(e,W,t),a(e,ue,t),a(e,X,t),a(e,fe,t),a(e,G,t),a(e,he,t),g(P,e,t),a(e,ge,t),a(e,R,t),a(e,be,t),a(e,E,t),a(e,_e,t),g(V,e,t),a(e,ye,t),g(Q,e,t),a(e,we,t),a(e,c,t),g(z,c,null),d(c,Ce),d(c,Y),d(c,ke),d(c,L),d(c,Be),d(c,J),g(H,J,null),d(J,Se),d(J,F),d(J,Ae),g(j,J,null),d(c,Ie),d(c,U),g(q,U,null),d(U,Ze),d(U,O),d(c,$e),d(c,x),g(N,x,null),d(x,We),d(x,K),a(e,Me,t),g(D,e,t),a(e,Te,t),a(e,ae,t),ve=!0},p(e,[t]){const u={};t&2&&(u.$$scope={dirty:t,ctx:e}),j.$set(u)},i(e){ve||(b(M.$$.fragment,e),b(T.$$.fragment,e),b(Z.$$.fragment,e),b(P.$$.fragment,e),b(V.$$.fragment,e),b(Q.$$.fragment,e),b(z.$$.fragment,e),b(H.$$.fragment,e),b(j.$$.fragment,e),b(q.$$.fragment,e),b(N.$$.fragment,e),b(D.$$.fragment,e),ve=!0)},o(e){_(M.$$.fragment,e),_(T.$$.fragment,e),_(Z.$$.fragment,e),_(P.$$.fragment,e),_(V.$$.fragment,e),_(Q.$$.fragment,e),_(z.$$.fragment,e),_(H.$$.fragment,e),_(j.$$.fragment,e),_(q.$$.fragment,e),_(N.$$.fragment,e),_(D.$$.fragment,e),ve=!1},d(e){e&&(n(C),n(v),n(w),n(r),n(se),n(k),n(ie),n(B),n(le),n(S),n(re),n(A),n(de),n(I),n(pe),n(ce),n($),n(me),n(W),n(ue),n(X),n(fe),n(G),n(he),n(ge),n(R),n(be),n(E),n(_e),n(ye),n(we),n(c),n(Me),n(Te),n(ae)),n(p),y(M,e),y(T,e),y(Z,e),y(P,e),y(V,e),y(Q,e),y(z),y(H),y(j),y(q),y(N),y(D,e)}}}const ct='{"title":"Stable Audio","local":"stable-audio","sections":[{"title":"Tips","local":"tips","sections":[],"depth":2},{"title":"Quantization","local":"quantization","sections":[],"depth":2},{"title":"StableAudioPipeline","local":"diffusers.StableAudioPipeline","sections":[],"depth":2}],"depth":1}';function mt(oe){return tt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wt extends at{constructor(p){super(),ot(this,p,mt,pt,et,{})}}export{wt as component};
