import{S as Ko,i as en,s as tn,e as n,k as p,w as T,t as s,M as on,c as i,d as o,m as c,a,x as D,h as r,b as d,G as t,g as u,y as $,q as L,o as P,B as x,v as nn,L as an}from"../../../chunks/vendor-hf-doc-builder.js";import{T as sn}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Oe}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as rn}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as ht}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ln}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function dn(fe){let m,M,h,g,b,f,y,j;return{c(){m=n("p"),M=s("Make sure to check out the Schedulers "),h=n("a"),g=s("guide"),b=s(" to learn how to explore the tradeoff between scheduler speed and quality, and see the "),f=n("a"),y=s("reuse components across pipelines"),j=s(" section to learn how to efficiently load the same components into multiple pipelines."),this.h()},l(C){m=i(C,"P",{});var w=a(m);M=r(w,"Make sure to check out the Schedulers "),h=i(w,"A",{href:!0});var _=a(h);g=r(_,"guide"),_.forEach(o),b=r(w," to learn how to explore the tradeoff between scheduler speed and quality, and see the "),f=i(w,"A",{href:!0});var me=a(f);y=r(me,"reuse components across pipelines"),me.forEach(o),j=r(w," section to learn how to efficiently load the same components into multiple pipelines."),w.forEach(o),this.h()},h(){d(h,"href","/using-diffusers/schedulers"),d(f,"href","/using-diffusers/loading#reuse-components-across-pipelines")},m(C,w){u(C,m,w),t(m,M),t(m,h),t(h,g),t(m,b),t(m,f),t(f,y),t(m,j)},d(C){C&&o(m)}}}function pn(fe){let m,M,h,g,b;return g=new rn({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1ZGlvTERNUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMHNjaXB5JTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMmN2c3NwJTJGYXVkaW9sZG0tcy1mdWxsLXYyJTIyJTBBcGlwZSUyMCUzRCUyMEF1ZGlvTERNUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKHJlcG9faWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJUZWNobm8lMjBtdXNpYyUyMHdpdGglMjBhJTIwc3Ryb25nJTJDJTIwdXBiZWF0JTIwdGVtcG8lMjBhbmQlMjBoaWdoJTIwbWVsb2RpYyUyMHJpZmZzJTIyJTBBYXVkaW8lMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxMCUyQyUyMGF1ZGlvX2xlbmd0aF9pbl9zJTNENS4wKS5hdWRpb3MlNUIwJTVEJTBBJTBBJTIzJTIwc2F2ZSUyMHRoZSUyMGF1ZGlvJTIwc2FtcGxlJTIwYXMlMjBhJTIwLndhdiUyMGZpbGUlMEFzY2lweS5pby53YXZmaWxlLndyaXRlKCUyMnRlY2huby53YXYlMjIlMkMlMjByYXRlJTNEMTYwMDAlMkMlMjBkYXRhJTNEYXVkaW8p",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AudioLDMPipeline
<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> scipy

<span class="hljs-meta">&gt;&gt;&gt; </span>repo_id = <span class="hljs-string">&quot;cvssp/audioldm-s-full-v2&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = AudioLDMPipeline.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>prompt = <span class="hljs-string">&quot;Techno music with a strong, upbeat tempo and high melodic riffs&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>audio = pipe(prompt, num_inference_steps=<span class="hljs-number">10</span>, audio_length_in_s=<span class="hljs-number">5.0</span>).audios[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save the audio sample as a .wav file</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>scipy.io.wavfile.write(<span class="hljs-string">&quot;techno.wav&quot;</span>, rate=<span class="hljs-number">16000</span>, data=audio)`}}),{c(){m=n("p"),M=s("Examples:"),h=p(),T(g.$$.fragment)},l(f){m=i(f,"P",{});var y=a(m);M=r(y,"Examples:"),y.forEach(o),h=c(f),D(g.$$.fragment,f)},m(f,y){u(f,m,y),t(m,M),u(f,h,y),$(g,f,y),b=!0},p:an,i(f){b||(L(g.$$.fragment,f),b=!0)},o(f){P(g.$$.fragment,f),b=!1},d(f){f&&o(m),f&&o(h),x(g,f)}}}function cn(fe){let m,M,h,g,b,f,y,j,C,w,_,me,Y,gt,_t,X,vt,bt,Ae,yt,wt,Q,Mt,At,Ve,he,Tt,ze,ge,K,Dt,ee,$t,Lt,Ze,J,Pt,te,xt,Et,Fe,U,q,Te,oe,kt,De,jt,He,_e,Ct,We,O,$e,Ut,It,Le,Nt,Re,ve,Gt,Ye,V,I,St,Pe,Bt,Jt,xe,qt,Ot,Vt,N,zt,Ee,Zt,Ft,ke,Ht,Wt,Xe,z,Qe,G,Z,je,ne,Rt,Ce,Yt,Ke,v,ie,Xt,Ue,Qt,Kt,ae,eo,be,to,oo,no,E,se,io,Ie,ao,so,F,ro,H,re,lo,le,po,Ne,co,uo,fo,W,de,mo,Ge,ho,et,S,R,Se,pe,go,Be,_o,tt,B,ce,vo,Je,bo,ot;return f=new ht({}),oe=new ht({}),z=new sn({props:{$$slots:{default:[dn]},$$scope:{ctx:fe}}}),ne=new ht({}),ie=new Oe({props:{name:"class diffusers.AudioLDMPipeline",anchor:"diffusers.AudioLDMPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": ClapTextModelWithProjection"},{name:"tokenizer",val:": typing.Union[transformers.models.roberta.tokenization_roberta.RobertaTokenizer, transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast]"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"vocoder",val:": SpeechT5HifiGan"}],parametersDescription:[{anchor:"diffusers.AudioLDMPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.AudioLDMPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clap#transformers.ClapTextModelWithProjection" rel="nofollow">ClapTextModelWithProjection</a>) &#x2014;
Frozen text-encoder (<code>ClapTextModelWithProjection</code>, specifically the
<a href="https://huggingface.co/laion/clap-htsat-unfused" rel="nofollow">laion/clap-htsat-unfused</a> variant.`,name:"text_encoder"},{anchor:"diffusers.AudioLDMPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>PreTrainedTokenizer</code>) &#x2014;
A <a href="https://huggingface.co/docs/transformers/main/en/model_doc/roberta#transformers.RobertaTokenizer" rel="nofollow">RobertaTokenizer</a> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.AudioLDMPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded audio latents.`,name:"unet"},{anchor:"diffusers.AudioLDMPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded audio latents. Can be one of
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.AudioLDMPipeline.vocoder",description:`<strong>vocoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/speecht5#transformers.SpeechT5HifiGan" rel="nofollow">SpeechT5HifiGan</a>) &#x2014;
Vocoder of class <code>SpeechT5HifiGan</code>.`,name:"vocoder"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L51"}}),se=new Oe({props:{name:"__call__",anchor:"diffusers.AudioLDMPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"audio_length_in_s",val:": typing.Optional[float] = None"},{name:"num_inference_steps",val:": int = 10"},{name:"guidance_scale",val:": float = 2.5"},{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.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": typing.Optional[int] = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"}],parametersDescription:[{anchor:"diffusers.AudioLDMPipeline.__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.AudioLDMPipeline.__call__.audio_length_in_s",description:`<strong>audio_length_in_s</strong> (<code>int</code>, <em>optional</em>, defaults to 5.12) &#x2014;
The length of the generated audio sample in seconds.`,name:"audio_length_in_s"},{anchor:"diffusers.AudioLDMPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#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.AudioLDMPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 2.5) &#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.AudioLDMPipeline.__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.AudioLDMPipeline.__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.AudioLDMPipeline.__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://arxiv.org/abs/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.AudioLDMPipeline.__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.AudioLDMPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
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.AudioLDMPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.AudioLDMPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.AudioLDMPipeline.__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/dance_diffusion#diffusers.AudioPipelineOutput">AudioPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.AudioLDMPipeline.__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.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.AudioLDMPipeline.__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.AudioLDMPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow"><code>self.processor</code></a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.AudioLDMPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generated image. 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.`,name:"output_type"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L364",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> is returned, otherwise a <code>tuple</code> is
returned where the first element is a list with the generated audio.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/main/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> or <code>tuple</code></p>
`}}),F=new ln({props:{anchor:"diffusers.AudioLDMPipeline.__call__.example",$$slots:{default:[pn]},$$scope:{ctx:fe}}}),re=new Oe({props:{name:"disable_vae_slicing",anchor:"diffusers.AudioLDMPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L105"}}),de=new Oe({props:{name:"enable_vae_slicing",anchor:"diffusers.AudioLDMPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L97"}}),pe=new ht({}),ce=new Oe({props:{name:"class diffusers.AudioPipelineOutput",anchor:"diffusers.AudioPipelineOutput",parameters:[{name:"audios",val:": ndarray"}],parametersDescription:[{anchor:"diffusers.AudioPipelineOutput.audios",description:`<strong>audios</strong> (<code>np.ndarray</code>) &#x2014;
List of denoised audio samples of a NumPy array of shape <code>(batch_size, num_channels, sample_rate)</code>.`,name:"audios"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L126"}}),{c(){m=n("meta"),M=p(),h=n("h1"),g=n("a"),b=n("span"),T(f.$$.fragment),y=p(),j=n("span"),C=s("AudioLDM"),w=p(),_=n("p"),me=s("AudioLDM was proposed in "),Y=n("a"),gt=s("AudioLDM: Text-to-Audio Generation with Latent Diffusion Models"),_t=s(" by Haohe Liu et al. Inspired by "),X=n("a"),vt=s("Stable Diffusion"),bt=s(`, AudioLDM
is a text-to-audio `),Ae=n("em"),yt=s("latent diffusion model (LDM)"),wt=s(" that learns continuous audio representations from "),Q=n("a"),Mt=s("CLAP"),At=s(`
latents. AudioLDM takes a text prompt as input and predicts the corresponding audio. It can generate text-conditional
sound effects, human speech and music.`),Ve=p(),he=n("p"),Tt=s("The abstract from the paper is:"),ze=p(),ge=n("p"),K=n("em"),Dt=s("Text-to-audio (TTA) system has recently gained attention for its ability to synthesize general audio based on text descriptions. However, previous studies in TTA have limited generation quality with high computational costs. In this study, we propose AudioLDM, a TTA system that is built on a latent space to learn the continuous audio representations from contrastive language-audio pretraining (CLAP) latents. The pretrained CLAP models enable us to train LDMs with audio embedding while providing text embedding as a condition during sampling. By learning the latent representations of audio signals and their compositions without modeling the cross-modal relationship, AudioLDM is advantageous in both generation quality and computational efficiency. Trained on AudioCaps with a single GPU, AudioLDM achieves state-of-the-art TTA performance measured by both objective and subjective metrics (e.g., frechet distance). Moreover, AudioLDM is the first TTA system that enables various text-guided audio manipulations (e.g., style transfer) in a zero-shot fashion. Our implementation and demos are available at "),ee=n("a"),$t=s("https://audioldm.github.io"),Lt=s("."),Ze=p(),J=n("p"),Pt=s("The original codebase can be found at "),te=n("a"),xt=s("haoheliu/AudioLDM"),Et=s("."),Fe=p(),U=n("h2"),q=n("a"),Te=n("span"),T(oe.$$.fragment),kt=p(),De=n("span"),jt=s("Tips"),He=p(),_e=n("p"),Ct=s("When constructing a prompt, keep in mind:"),We=p(),O=n("ul"),$e=n("li"),Ut=s("Descriptive prompt inputs work best; you can use adjectives to describe the sound (for example, \u201Chigh quality\u201D or \u201Cclear\u201D) and make the prompt context specific (for example, \u201Cwater stream in a forest\u201D instead of \u201Cstream\u201D)."),It=p(),Le=n("li"),Nt=s("It\u2019s best to use general terms like \u201Ccat\u201D or \u201Cdog\u201D instead of specific names or abstract objects the model may not be familiar with."),Re=p(),ve=n("p"),Gt=s("During inference:"),Ye=p(),V=n("ul"),I=n("li"),St=s("The "),Pe=n("em"),Bt=s("quality"),Jt=s(" of the predicted audio sample can be controlled by the "),xe=n("code"),qt=s("num_inference_steps"),Ot=s(" argument; higher steps give higher quality audio at the expense of slower inference."),Vt=p(),N=n("li"),zt=s("The "),Ee=n("em"),Zt=s("length"),Ft=s(" of the predicted audio sample can be controlled by varying the "),ke=n("code"),Ht=s("audio_length_in_s"),Wt=s(" argument."),Xe=p(),T(z.$$.fragment),Qe=p(),G=n("h2"),Z=n("a"),je=n("span"),T(ne.$$.fragment),Rt=p(),Ce=n("span"),Yt=s("AudioLDMPipeline"),Ke=p(),v=n("div"),T(ie.$$.fragment),Xt=p(),Ue=n("p"),Qt=s("Pipeline for text-to-audio generation using AudioLDM."),Kt=p(),ae=n("p"),eo=s("This model inherits from "),be=n("a"),to=s("DiffusionPipeline"),oo=s(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),no=p(),E=n("div"),T(se.$$.fragment),io=p(),Ie=n("p"),ao=s("The call function to the pipeline for generation."),so=p(),T(F.$$.fragment),ro=p(),H=n("div"),T(re.$$.fragment),lo=p(),le=n("p"),po=s("Disable sliced VAE decoding. If "),Ne=n("code"),co=s("enable_vae_slicing"),uo=s(` was previously enabled, this method will go back to
computing decoding in one step.`),fo=p(),W=n("div"),T(de.$$.fragment),mo=p(),Ge=n("p"),ho=s(`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.`),et=p(),S=n("h2"),R=n("a"),Se=n("span"),T(pe.$$.fragment),go=p(),Be=n("span"),_o=s("AudioPipelineOutput"),tt=p(),B=n("div"),T(ce.$$.fragment),vo=p(),Je=n("p"),bo=s("Output class for audio pipelines."),this.h()},l(e){const l=on('[data-svelte="svelte-1phssyn"]',document.head);m=i(l,"META",{name:!0,content:!0}),l.forEach(o),M=c(e),h=i(e,"H1",{class:!0});var ue=a(h);g=i(ue,"A",{id:!0,class:!0,href:!0});var qe=a(g);b=i(qe,"SPAN",{});var yo=a(b);D(f.$$.fragment,yo),yo.forEach(o),qe.forEach(o),y=c(ue),j=i(ue,"SPAN",{});var wo=a(j);C=r(wo,"AudioLDM"),wo.forEach(o),ue.forEach(o),w=c(e),_=i(e,"P",{});var k=a(_);me=r(k,"AudioLDM was proposed in "),Y=i(k,"A",{href:!0,rel:!0});var Mo=a(Y);gt=r(Mo,"AudioLDM: Text-to-Audio Generation with Latent Diffusion Models"),Mo.forEach(o),_t=r(k," by Haohe Liu et al. Inspired by "),X=i(k,"A",{href:!0,rel:!0});var Ao=a(X);vt=r(Ao,"Stable Diffusion"),Ao.forEach(o),bt=r(k,`, AudioLDM
is a text-to-audio `),Ae=i(k,"EM",{});var To=a(Ae);yt=r(To,"latent diffusion model (LDM)"),To.forEach(o),wt=r(k," that learns continuous audio representations from "),Q=i(k,"A",{href:!0,rel:!0});var Do=a(Q);Mt=r(Do,"CLAP"),Do.forEach(o),At=r(k,`
latents. AudioLDM takes a text prompt as input and predicts the corresponding audio. It can generate text-conditional
sound effects, human speech and music.`),k.forEach(o),Ve=c(e),he=i(e,"P",{});var $o=a(he);Tt=r($o,"The abstract from the paper is:"),$o.forEach(o),ze=c(e),ge=i(e,"P",{});var Lo=a(ge);K=i(Lo,"EM",{});var nt=a(K);Dt=r(nt,"Text-to-audio (TTA) system has recently gained attention for its ability to synthesize general audio based on text descriptions. However, previous studies in TTA have limited generation quality with high computational costs. In this study, we propose AudioLDM, a TTA system that is built on a latent space to learn the continuous audio representations from contrastive language-audio pretraining (CLAP) latents. The pretrained CLAP models enable us to train LDMs with audio embedding while providing text embedding as a condition during sampling. By learning the latent representations of audio signals and their compositions without modeling the cross-modal relationship, AudioLDM is advantageous in both generation quality and computational efficiency. Trained on AudioCaps with a single GPU, AudioLDM achieves state-of-the-art TTA performance measured by both objective and subjective metrics (e.g., frechet distance). Moreover, AudioLDM is the first TTA system that enables various text-guided audio manipulations (e.g., style transfer) in a zero-shot fashion. Our implementation and demos are available at "),ee=i(nt,"A",{href:!0,rel:!0});var Po=a(ee);$t=r(Po,"https://audioldm.github.io"),Po.forEach(o),Lt=r(nt,"."),nt.forEach(o),Lo.forEach(o),Ze=c(e),J=i(e,"P",{});var it=a(J);Pt=r(it,"The original codebase can be found at "),te=i(it,"A",{href:!0,rel:!0});var xo=a(te);xt=r(xo,"haoheliu/AudioLDM"),xo.forEach(o),Et=r(it,"."),it.forEach(o),Fe=c(e),U=i(e,"H2",{class:!0});var at=a(U);q=i(at,"A",{id:!0,class:!0,href:!0});var Eo=a(q);Te=i(Eo,"SPAN",{});var ko=a(Te);D(oe.$$.fragment,ko),ko.forEach(o),Eo.forEach(o),kt=c(at),De=i(at,"SPAN",{});var jo=a(De);jt=r(jo,"Tips"),jo.forEach(o),at.forEach(o),He=c(e),_e=i(e,"P",{});var Co=a(_e);Ct=r(Co,"When constructing a prompt, keep in mind:"),Co.forEach(o),We=c(e),O=i(e,"UL",{});var st=a(O);$e=i(st,"LI",{});var Uo=a($e);Ut=r(Uo,"Descriptive prompt inputs work best; you can use adjectives to describe the sound (for example, \u201Chigh quality\u201D or \u201Cclear\u201D) and make the prompt context specific (for example, \u201Cwater stream in a forest\u201D instead of \u201Cstream\u201D)."),Uo.forEach(o),It=c(st),Le=i(st,"LI",{});var Io=a(Le);Nt=r(Io,"It\u2019s best to use general terms like \u201Ccat\u201D or \u201Cdog\u201D instead of specific names or abstract objects the model may not be familiar with."),Io.forEach(o),st.forEach(o),Re=c(e),ve=i(e,"P",{});var No=a(ve);Gt=r(No,"During inference:"),No.forEach(o),Ye=c(e),V=i(e,"UL",{});var rt=a(V);I=i(rt,"LI",{});var ye=a(I);St=r(ye,"The "),Pe=i(ye,"EM",{});var Go=a(Pe);Bt=r(Go,"quality"),Go.forEach(o),Jt=r(ye," of the predicted audio sample can be controlled by the "),xe=i(ye,"CODE",{});var So=a(xe);qt=r(So,"num_inference_steps"),So.forEach(o),Ot=r(ye," argument; higher steps give higher quality audio at the expense of slower inference."),ye.forEach(o),Vt=c(rt),N=i(rt,"LI",{});var we=a(N);zt=r(we,"The "),Ee=i(we,"EM",{});var Bo=a(Ee);Zt=r(Bo,"length"),Bo.forEach(o),Ft=r(we," of the predicted audio sample can be controlled by varying the "),ke=i(we,"CODE",{});var Jo=a(ke);Ht=r(Jo,"audio_length_in_s"),Jo.forEach(o),Wt=r(we," argument."),we.forEach(o),rt.forEach(o),Xe=c(e),D(z.$$.fragment,e),Qe=c(e),G=i(e,"H2",{class:!0});var lt=a(G);Z=i(lt,"A",{id:!0,class:!0,href:!0});var qo=a(Z);je=i(qo,"SPAN",{});var Oo=a(je);D(ne.$$.fragment,Oo),Oo.forEach(o),qo.forEach(o),Rt=c(lt),Ce=i(lt,"SPAN",{});var Vo=a(Ce);Yt=r(Vo,"AudioLDMPipeline"),Vo.forEach(o),lt.forEach(o),Ke=c(e),v=i(e,"DIV",{class:!0});var A=a(v);D(ie.$$.fragment,A),Xt=c(A),Ue=i(A,"P",{});var zo=a(Ue);Qt=r(zo,"Pipeline for text-to-audio generation using AudioLDM."),zo.forEach(o),Kt=c(A),ae=i(A,"P",{});var dt=a(ae);eo=r(dt,"This model inherits from "),be=i(dt,"A",{href:!0});var Zo=a(be);to=r(Zo,"DiffusionPipeline"),Zo.forEach(o),oo=r(dt,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),dt.forEach(o),no=c(A),E=i(A,"DIV",{class:!0});var Me=a(E);D(se.$$.fragment,Me),io=c(Me),Ie=i(Me,"P",{});var Fo=a(Ie);ao=r(Fo,"The call function to the pipeline for generation."),Fo.forEach(o),so=c(Me),D(F.$$.fragment,Me),Me.forEach(o),ro=c(A),H=i(A,"DIV",{class:!0});var pt=a(H);D(re.$$.fragment,pt),lo=c(pt),le=i(pt,"P",{});var ct=a(le);po=r(ct,"Disable sliced VAE decoding. If "),Ne=i(ct,"CODE",{});var Ho=a(Ne);co=r(Ho,"enable_vae_slicing"),Ho.forEach(o),uo=r(ct,` was previously enabled, this method will go back to
computing decoding in one step.`),ct.forEach(o),pt.forEach(o),fo=c(A),W=i(A,"DIV",{class:!0});var ut=a(W);D(de.$$.fragment,ut),mo=c(ut),Ge=i(ut,"P",{});var Wo=a(Ge);ho=r(Wo,`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.`),Wo.forEach(o),ut.forEach(o),A.forEach(o),et=c(e),S=i(e,"H2",{class:!0});var ft=a(S);R=i(ft,"A",{id:!0,class:!0,href:!0});var Ro=a(R);Se=i(Ro,"SPAN",{});var Yo=a(Se);D(pe.$$.fragment,Yo),Yo.forEach(o),Ro.forEach(o),go=c(ft),Be=i(ft,"SPAN",{});var Xo=a(Be);_o=r(Xo,"AudioPipelineOutput"),Xo.forEach(o),ft.forEach(o),tt=c(e),B=i(e,"DIV",{class:!0});var mt=a(B);D(ce.$$.fragment,mt),vo=c(mt),Je=i(mt,"P",{});var Qo=a(Je);bo=r(Qo,"Output class for audio pipelines."),Qo.forEach(o),mt.forEach(o),this.h()},h(){d(m,"name","hf:doc:metadata"),d(m,"content",JSON.stringify(un)),d(g,"id","audioldm"),d(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(g,"href","#audioldm"),d(h,"class","relative group"),d(Y,"href","https://huggingface.co/papers/2301.12503"),d(Y,"rel","nofollow"),d(X,"href","https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/overview"),d(X,"rel","nofollow"),d(Q,"href","https://huggingface.co/docs/transformers/main/model_doc/clap"),d(Q,"rel","nofollow"),d(ee,"href","https://audioldm.github.io"),d(ee,"rel","nofollow"),d(te,"href","https://github.com/haoheliu/AudioLDM"),d(te,"rel","nofollow"),d(q,"id","tips"),d(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(q,"href","#tips"),d(U,"class","relative group"),d(Z,"id","diffusers.AudioLDMPipeline"),d(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Z,"href","#diffusers.AudioLDMPipeline"),d(G,"class","relative group"),d(be,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(R,"id","diffusers.AudioPipelineOutput"),d(R,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(R,"href","#diffusers.AudioPipelineOutput"),d(S,"class","relative group"),d(B,"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,l){t(document.head,m),u(e,M,l),u(e,h,l),t(h,g),t(g,b),$(f,b,null),t(h,y),t(h,j),t(j,C),u(e,w,l),u(e,_,l),t(_,me),t(_,Y),t(Y,gt),t(_,_t),t(_,X),t(X,vt),t(_,bt),t(_,Ae),t(Ae,yt),t(_,wt),t(_,Q),t(Q,Mt),t(_,At),u(e,Ve,l),u(e,he,l),t(he,Tt),u(e,ze,l),u(e,ge,l),t(ge,K),t(K,Dt),t(K,ee),t(ee,$t),t(K,Lt),u(e,Ze,l),u(e,J,l),t(J,Pt),t(J,te),t(te,xt),t(J,Et),u(e,Fe,l),u(e,U,l),t(U,q),t(q,Te),$(oe,Te,null),t(U,kt),t(U,De),t(De,jt),u(e,He,l),u(e,_e,l),t(_e,Ct),u(e,We,l),u(e,O,l),t(O,$e),t($e,Ut),t(O,It),t(O,Le),t(Le,Nt),u(e,Re,l),u(e,ve,l),t(ve,Gt),u(e,Ye,l),u(e,V,l),t(V,I),t(I,St),t(I,Pe),t(Pe,Bt),t(I,Jt),t(I,xe),t(xe,qt),t(I,Ot),t(V,Vt),t(V,N),t(N,zt),t(N,Ee),t(Ee,Zt),t(N,Ft),t(N,ke),t(ke,Ht),t(N,Wt),u(e,Xe,l),$(z,e,l),u(e,Qe,l),u(e,G,l),t(G,Z),t(Z,je),$(ne,je,null),t(G,Rt),t(G,Ce),t(Ce,Yt),u(e,Ke,l),u(e,v,l),$(ie,v,null),t(v,Xt),t(v,Ue),t(Ue,Qt),t(v,Kt),t(v,ae),t(ae,eo),t(ae,be),t(be,to),t(ae,oo),t(v,no),t(v,E),$(se,E,null),t(E,io),t(E,Ie),t(Ie,ao),t(E,so),$(F,E,null),t(v,ro),t(v,H),$(re,H,null),t(H,lo),t(H,le),t(le,po),t(le,Ne),t(Ne,co),t(le,uo),t(v,fo),t(v,W),$(de,W,null),t(W,mo),t(W,Ge),t(Ge,ho),u(e,et,l),u(e,S,l),t(S,R),t(R,Se),$(pe,Se,null),t(S,go),t(S,Be),t(Be,_o),u(e,tt,l),u(e,B,l),$(ce,B,null),t(B,vo),t(B,Je),t(Je,bo),ot=!0},p(e,[l]){const ue={};l&2&&(ue.$$scope={dirty:l,ctx:e}),z.$set(ue);const qe={};l&2&&(qe.$$scope={dirty:l,ctx:e}),F.$set(qe)},i(e){ot||(L(f.$$.fragment,e),L(oe.$$.fragment,e),L(z.$$.fragment,e),L(ne.$$.fragment,e),L(ie.$$.fragment,e),L(se.$$.fragment,e),L(F.$$.fragment,e),L(re.$$.fragment,e),L(de.$$.fragment,e),L(pe.$$.fragment,e),L(ce.$$.fragment,e),ot=!0)},o(e){P(f.$$.fragment,e),P(oe.$$.fragment,e),P(z.$$.fragment,e),P(ne.$$.fragment,e),P(ie.$$.fragment,e),P(se.$$.fragment,e),P(F.$$.fragment,e),P(re.$$.fragment,e),P(de.$$.fragment,e),P(pe.$$.fragment,e),P(ce.$$.fragment,e),ot=!1},d(e){o(m),e&&o(M),e&&o(h),x(f),e&&o(w),e&&o(_),e&&o(Ve),e&&o(he),e&&o(ze),e&&o(ge),e&&o(Ze),e&&o(J),e&&o(Fe),e&&o(U),x(oe),e&&o(He),e&&o(_e),e&&o(We),e&&o(O),e&&o(Re),e&&o(ve),e&&o(Ye),e&&o(V),e&&o(Xe),x(z,e),e&&o(Qe),e&&o(G),x(ne),e&&o(Ke),e&&o(v),x(ie),x(se),x(F),x(re),x(de),e&&o(et),e&&o(S),x(pe),e&&o(tt),e&&o(B),x(ce)}}}const un={local:"audioldm",sections:[{local:"tips",title:"Tips"},{local:"diffusers.AudioLDMPipeline",title:"AudioLDMPipeline"},{local:"diffusers.AudioPipelineOutput",title:"AudioPipelineOutput"}],title:"AudioLDM"};function fn(fe){return nn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yn extends Ko{constructor(m){super();en(this,m,fn,cn,tn,{})}}export{yn as default,un as metadata};
