import{S as Ko,i as ei,s as ti,e as i,k as p,w as T,t as s,M as oi,c as n,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 ii,L as ni}from"../../../chunks/vendor-hf-doc-builder.js";import{T as ai}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Oe}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as si}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as mt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ri}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function li(fe){let h,M,m,g,b,f,y,j;return{c(){h=i("p"),M=s("Make sure to check out the Schedulers "),m=i("a"),g=s("guide"),b=s(" to learn how to explore the tradeoff between scheduler speed and quality, and see the "),f=i("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(U){h=n(U,"P",{});var w=a(h);M=r(w,"Make sure to check out the Schedulers "),m=n(w,"A",{href:!0});var _=a(m);g=r(_,"guide"),_.forEach(o),b=r(w," to learn how to explore the tradeoff between scheduler speed and quality, and see the "),f=n(w,"A",{href:!0});var he=a(f);y=r(he,"reuse components across pipelines"),he.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(m,"href","/using-diffusers/schedulers"),d(f,"href","/using-diffusers/loading#reuse-components-across-pipelines")},m(U,w){u(U,h,w),t(h,M),t(h,m),t(m,g),t(h,b),t(h,f),t(f,y),t(h,j)},d(U){U&&o(h)}}}function di(fe){let h,M,m,g,b;return g=new si({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(){h=i("p"),M=s("Examples:"),m=p(),T(g.$$.fragment)},l(f){h=n(f,"P",{});var y=a(h);M=r(y,"Examples:"),y.forEach(o),m=c(f),D(g.$$.fragment,f)},m(f,y){u(f,h,y),t(h,M),u(f,m,y),$(g,f,y),b=!0},p:ni,i(f){b||(L(g.$$.fragment,f),b=!0)},o(f){P(g.$$.fragment,f),b=!1},d(f){f&&o(h),f&&o(m),x(g,f)}}}function pi(fe){let h,M,m,g,b,f,y,j,U,w,_,he,Y,gt,_t,X,vt,bt,Ae,yt,wt,Q,Mt,At,Ve,me,Tt,ze,ge,K,Dt,ee,$t,Lt,Ze,J,Pt,te,xt,Et,Fe,C,q,Te,oe,kt,De,jt,He,_e,Ut,We,O,$e,Ct,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,ie,Rt,Ue,Yt,Ke,v,ne,Xt,Ce,Qt,Kt,ae,eo,be,to,oo,io,E,se,no,Ie,ao,so,F,ro,H,re,lo,le,po,Ne,co,uo,fo,W,de,ho,Ge,mo,et,S,R,Se,pe,go,Be,_o,tt,B,ce,vo,Je,bo,ot;return f=new mt({}),oe=new mt({}),z=new ai({props:{$$slots:{default:[li]},$$scope:{ctx:fe}}}),ie=new mt({}),ne=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/v0.21.0/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> (<code>ClapTextModelWithProjection</code>) &#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 <code>RobertaTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.AudioLDMPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.21.0/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/v0.21.0/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/v0.21.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.21.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.21.0/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.AudioLDMPipeline.vocoder",description:`<strong>vocoder</strong> (<code>SpeechT5HifiGan</code>) &#x2014;
Vocoder of class <code>SpeechT5HifiGan</code>.`,name:"vocoder"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L52"}}),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/v0.21.0/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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L366",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.21.0/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/v0.21.0/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> or <code>tuple</code></p>
`}}),F=new ri({props:{anchor:"diffusers.AudioLDMPipeline.__call__.example",$$slots:{default:[di]},$$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/v0.21.0/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L107"}}),de=new Oe({props:{name:"enable_vae_slicing",anchor:"diffusers.AudioLDMPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L99"}}),pe=new mt({}),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/v0.21.0/src/diffusers/pipelines/pipeline_utils.py#L126"}}),{c(){h=i("meta"),M=p(),m=i("h1"),g=i("a"),b=i("span"),T(f.$$.fragment),y=p(),j=i("span"),U=s("AudioLDM"),w=p(),_=i("p"),he=s("AudioLDM was proposed in "),Y=i("a"),gt=s("AudioLDM: Text-to-Audio Generation with Latent Diffusion Models"),_t=s(" by Haohe Liu et al. Inspired by "),X=i("a"),vt=s("Stable Diffusion"),bt=s(`, AudioLDM
is a text-to-audio `),Ae=i("em"),yt=s("latent diffusion model (LDM)"),wt=s(" that learns continuous audio representations from "),Q=i("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(),me=i("p"),Tt=s("The abstract from the paper is:"),ze=p(),ge=i("p"),K=i("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=i("a"),$t=s("https://audioldm.github.io"),Lt=s("."),Ze=p(),J=i("p"),Pt=s("The original codebase can be found at "),te=i("a"),xt=s("haoheliu/AudioLDM"),Et=s("."),Fe=p(),C=i("h2"),q=i("a"),Te=i("span"),T(oe.$$.fragment),kt=p(),De=i("span"),jt=s("Tips"),He=p(),_e=i("p"),Ut=s("When constructing a prompt, keep in mind:"),We=p(),O=i("ul"),$e=i("li"),Ct=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=i("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=i("p"),Gt=s("During inference:"),Ye=p(),V=i("ul"),I=i("li"),St=s("The "),Pe=i("em"),Bt=s("quality"),Jt=s(" of the predicted audio sample can be controlled by the "),xe=i("code"),qt=s("num_inference_steps"),Ot=s(" argument; higher steps give higher quality audio at the expense of slower inference."),Vt=p(),N=i("li"),zt=s("The "),Ee=i("em"),Zt=s("length"),Ft=s(" of the predicted audio sample can be controlled by varying the "),ke=i("code"),Ht=s("audio_length_in_s"),Wt=s(" argument."),Xe=p(),T(z.$$.fragment),Qe=p(),G=i("h2"),Z=i("a"),je=i("span"),T(ie.$$.fragment),Rt=p(),Ue=i("span"),Yt=s("AudioLDMPipeline"),Ke=p(),v=i("div"),T(ne.$$.fragment),Xt=p(),Ce=i("p"),Qt=s("Pipeline for text-to-audio generation using AudioLDM."),Kt=p(),ae=i("p"),eo=s("This model inherits from "),be=i("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.).`),io=p(),E=i("div"),T(se.$$.fragment),no=p(),Ie=i("p"),ao=s("The call function to the pipeline for generation."),so=p(),T(F.$$.fragment),ro=p(),H=i("div"),T(re.$$.fragment),lo=p(),le=i("p"),po=s("Disable sliced VAE decoding. If "),Ne=i("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=i("div"),T(de.$$.fragment),ho=p(),Ge=i("p"),mo=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=i("h2"),R=i("a"),Se=i("span"),T(pe.$$.fragment),go=p(),Be=i("span"),_o=s("AudioPipelineOutput"),tt=p(),B=i("div"),T(ce.$$.fragment),vo=p(),Je=i("p"),bo=s("Output class for audio pipelines."),this.h()},l(e){const l=oi('[data-svelte="svelte-1phssyn"]',document.head);h=n(l,"META",{name:!0,content:!0}),l.forEach(o),M=c(e),m=n(e,"H1",{class:!0});var ue=a(m);g=n(ue,"A",{id:!0,class:!0,href:!0});var qe=a(g);b=n(qe,"SPAN",{});var yo=a(b);D(f.$$.fragment,yo),yo.forEach(o),qe.forEach(o),y=c(ue),j=n(ue,"SPAN",{});var wo=a(j);U=r(wo,"AudioLDM"),wo.forEach(o),ue.forEach(o),w=c(e),_=n(e,"P",{});var k=a(_);he=r(k,"AudioLDM was proposed in "),Y=n(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=n(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=n(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=n(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),me=n(e,"P",{});var $o=a(me);Tt=r($o,"The abstract from the paper is:"),$o.forEach(o),ze=c(e),ge=n(e,"P",{});var Lo=a(ge);K=n(Lo,"EM",{});var it=a(K);Dt=r(it,"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(it,"A",{href:!0,rel:!0});var Po=a(ee);$t=r(Po,"https://audioldm.github.io"),Po.forEach(o),Lt=r(it,"."),it.forEach(o),Lo.forEach(o),Ze=c(e),J=n(e,"P",{});var nt=a(J);Pt=r(nt,"The original codebase can be found at "),te=n(nt,"A",{href:!0,rel:!0});var xo=a(te);xt=r(xo,"haoheliu/AudioLDM"),xo.forEach(o),Et=r(nt,"."),nt.forEach(o),Fe=c(e),C=n(e,"H2",{class:!0});var at=a(C);q=n(at,"A",{id:!0,class:!0,href:!0});var Eo=a(q);Te=n(Eo,"SPAN",{});var ko=a(Te);D(oe.$$.fragment,ko),ko.forEach(o),Eo.forEach(o),kt=c(at),De=n(at,"SPAN",{});var jo=a(De);jt=r(jo,"Tips"),jo.forEach(o),at.forEach(o),He=c(e),_e=n(e,"P",{});var Uo=a(_e);Ut=r(Uo,"When constructing a prompt, keep in mind:"),Uo.forEach(o),We=c(e),O=n(e,"UL",{});var st=a(O);$e=n(st,"LI",{});var Co=a($e);Ct=r(Co,"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)."),Co.forEach(o),It=c(st),Le=n(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=n(e,"P",{});var No=a(ve);Gt=r(No,"During inference:"),No.forEach(o),Ye=c(e),V=n(e,"UL",{});var rt=a(V);I=n(rt,"LI",{});var ye=a(I);St=r(ye,"The "),Pe=n(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=n(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=n(rt,"LI",{});var we=a(N);zt=r(we,"The "),Ee=n(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=n(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=n(e,"H2",{class:!0});var lt=a(G);Z=n(lt,"A",{id:!0,class:!0,href:!0});var qo=a(Z);je=n(qo,"SPAN",{});var Oo=a(je);D(ie.$$.fragment,Oo),Oo.forEach(o),qo.forEach(o),Rt=c(lt),Ue=n(lt,"SPAN",{});var Vo=a(Ue);Yt=r(Vo,"AudioLDMPipeline"),Vo.forEach(o),lt.forEach(o),Ke=c(e),v=n(e,"DIV",{class:!0});var A=a(v);D(ne.$$.fragment,A),Xt=c(A),Ce=n(A,"P",{});var zo=a(Ce);Qt=r(zo,"Pipeline for text-to-audio generation using AudioLDM."),zo.forEach(o),Kt=c(A),ae=n(A,"P",{});var dt=a(ae);eo=r(dt,"This model inherits from "),be=n(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),io=c(A),E=n(A,"DIV",{class:!0});var Me=a(E);D(se.$$.fragment,Me),no=c(Me),Ie=n(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=n(A,"DIV",{class:!0});var pt=a(H);D(re.$$.fragment,pt),lo=c(pt),le=n(pt,"P",{});var ct=a(le);po=r(ct,"Disable sliced VAE decoding. If "),Ne=n(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=n(A,"DIV",{class:!0});var ut=a(W);D(de.$$.fragment,ut),ho=c(ut),Ge=n(ut,"P",{});var Wo=a(Ge);mo=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=n(e,"H2",{class:!0});var ft=a(S);R=n(ft,"A",{id:!0,class:!0,href:!0});var Ro=a(R);Se=n(Ro,"SPAN",{});var Yo=a(Se);D(pe.$$.fragment,Yo),Yo.forEach(o),Ro.forEach(o),go=c(ft),Be=n(ft,"SPAN",{});var Xo=a(Be);_o=r(Xo,"AudioPipelineOutput"),Xo.forEach(o),ft.forEach(o),tt=c(e),B=n(e,"DIV",{class:!0});var ht=a(B);D(ce.$$.fragment,ht),vo=c(ht),Je=n(ht,"P",{});var Qo=a(Je);bo=r(Qo,"Output class for audio pipelines."),Qo.forEach(o),ht.forEach(o),this.h()},h(){d(h,"name","hf:doc:metadata"),d(h,"content",JSON.stringify(ci)),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(m,"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(C,"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/v0.21.0/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,h),u(e,M,l),u(e,m,l),t(m,g),t(g,b),$(f,b,null),t(m,y),t(m,j),t(j,U),u(e,w,l),u(e,_,l),t(_,he),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,me,l),t(me,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,C,l),t(C,q),t(q,Te),$(oe,Te,null),t(C,kt),t(C,De),t(De,jt),u(e,He,l),u(e,_e,l),t(_e,Ut),u(e,We,l),u(e,O,l),t(O,$e),t($e,Ct),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),$(ie,je,null),t(G,Rt),t(G,Ue),t(Ue,Yt),u(e,Ke,l),u(e,v,l),$(ne,v,null),t(v,Xt),t(v,Ce),t(Ce,Qt),t(v,Kt),t(v,ae),t(ae,eo),t(ae,be),t(be,to),t(ae,oo),t(v,io),t(v,E),$(se,E,null),t(E,no),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,ho),t(W,Ge),t(Ge,mo),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(ie.$$.fragment,e),L(ne.$$.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(ie.$$.fragment,e),P(ne.$$.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(h),e&&o(M),e&&o(m),x(f),e&&o(w),e&&o(_),e&&o(Ve),e&&o(me),e&&o(ze),e&&o(ge),e&&o(Ze),e&&o(J),e&&o(Fe),e&&o(C),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(ie),e&&o(Ke),e&&o(v),x(ne),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 ci={local:"audioldm",sections:[{local:"tips",title:"Tips"},{local:"diffusers.AudioLDMPipeline",title:"AudioLDMPipeline"},{local:"diffusers.AudioPipelineOutput",title:"AudioPipelineOutput"}],title:"AudioLDM"};function ui(fe){return ii(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bi extends Ko{constructor(h){super();ei(this,h,ui,pi,ti,{})}}export{bi as default,ci as metadata};
