import{S as Ko,i as en,s as tn,e as n,k as p,w as A,t as s,M as on,c as i,d as o,m as c,a,x as T,h as r,b as d,G as t,g as u,y as L,q as $,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 qe}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,v,f,y,S;return{c(){m=n("p"),M=s("Make sure to check out the Schedulers "),h=n("a"),g=s("guide"),v=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"),S=s(" section to learn how to efficiently load the same components into multiple pipelines."),this.h()},l(I){m=i(I,"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),v=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),S=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(I,w){u(I,m,w),t(m,M),t(m,h),t(h,g),t(m,v),t(m,f),t(f,y),t(m,S)},d(I){I&&o(m)}}}function pn(fe){let m,M,h,g,v;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(),A(g.$$.fragment)},l(f){m=i(f,"P",{});var y=a(m);M=r(y,"Examples:"),y.forEach(o),h=c(f),T(g.$$.fragment,f)},m(f,y){u(f,m,y),t(m,M),u(f,h,y),L(g,f,y),v=!0},p:an,i(f){v||($(g.$$.fragment,f),v=!0)},o(f){P(g.$$.fragment,f),v=!1},d(f){f&&o(m),f&&o(h),x(g,f)}}}function cn(fe){let m,M,h,g,v,f,y,S,I,w,_,me,Y,gt,_t,X,bt,vt,De,yt,wt,Q,Mt,Dt,ze,he,At,Ve,ge,K,Tt,ee,Lt,$t,Ze,J,Pt,te,xt,Et,Fe,j,O,Ae,oe,kt,Te,St,He,_e,It,We,q,Le,jt,Ct,$e,Ut,Re,be,Nt,Ye,z,C,Gt,Pe,Bt,Jt,xe,Ot,qt,zt,U,Vt,Ee,Zt,Ft,ke,Ht,Wt,Xe,V,Qe,N,Z,Se,ne,Rt,Ie,Yt,Ke,b,ie,Xt,je,Qt,Kt,ae,eo,ve,to,oo,no,E,se,io,Ce,ao,so,F,ro,H,re,lo,le,po,Ue,co,uo,fo,W,de,mo,Ne,ho,et,G,R,Ge,pe,go,Be,_o,tt,B,ce,bo,Je,vo,ot;return f=new ht({}),oe=new ht({}),V=new sn({props:{$$slots:{default:[dn]},$$scope:{ctx:fe}}}),ne=new ht({}),ie=new qe({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 qe({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/stable_diffusion/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</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/stable_diffusion/upscale#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:`
<p><a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),F=new ln({props:{anchor:"diffusers.AudioLDMPipeline.__call__.example",$$slots:{default:[pn]},$$scope:{ctx:fe}}}),re=new qe({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 qe({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 qe({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content or
<code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/__init__.py#L22"}}),{c(){m=n("meta"),M=p(),h=n("h1"),g=n("a"),v=n("span"),A(f.$$.fragment),y=p(),S=n("span"),I=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"),bt=s("Stable Diffusion"),vt=s(`, AudioLDM
is a text-to-audio `),De=n("em"),yt=s("latent diffusion model (LDM)"),wt=s(" that learns continuous audio representations from "),Q=n("a"),Mt=s("CLAP"),Dt=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.`),ze=p(),he=n("p"),At=s("The abstract from the paper is:"),Ve=p(),ge=n("p"),K=n("em"),Tt=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"),Lt=s("https://audioldm.github.io"),$t=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(),j=n("h2"),O=n("a"),Ae=n("span"),A(oe.$$.fragment),kt=p(),Te=n("span"),St=s("Tips"),He=p(),_e=n("p"),It=s("When constructing a prompt, keep in mind:"),We=p(),q=n("ul"),Le=n("li"),jt=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)."),Ct=p(),$e=n("li"),Ut=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(),be=n("p"),Nt=s("During inference:"),Ye=p(),z=n("ul"),C=n("li"),Gt=s("The "),Pe=n("em"),Bt=s("quality"),Jt=s(" of the predicted audio sample can be controlled by the "),xe=n("code"),Ot=s("num_inference_steps"),qt=s(" argument; higher steps give higher quality audio at the expense of slower inference."),zt=p(),U=n("li"),Vt=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(),A(V.$$.fragment),Qe=p(),N=n("h2"),Z=n("a"),Se=n("span"),A(ne.$$.fragment),Rt=p(),Ie=n("span"),Yt=s("AudioLDMPipeline"),Ke=p(),b=n("div"),A(ie.$$.fragment),Xt=p(),je=n("p"),Qt=s("Pipeline for text-to-audio generation using AudioLDM."),Kt=p(),ae=n("p"),eo=s("This model inherits from "),ve=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"),A(se.$$.fragment),io=p(),Ce=n("p"),ao=s("The call function to the pipeline for generation."),so=p(),A(F.$$.fragment),ro=p(),H=n("div"),A(re.$$.fragment),lo=p(),le=n("p"),po=s("Disable sliced VAE decoding. If "),Ue=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"),A(de.$$.fragment),mo=p(),Ne=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(),G=n("h2"),R=n("a"),Ge=n("span"),A(pe.$$.fragment),go=p(),Be=n("span"),_o=s("StableDiffusionPipelineOutput"),tt=p(),B=n("div"),A(ce.$$.fragment),bo=p(),Je=n("p"),vo=s("Output class for Stable Diffusion 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 Oe=a(g);v=i(Oe,"SPAN",{});var yo=a(v);T(f.$$.fragment,yo),yo.forEach(o),Oe.forEach(o),y=c(ue),S=i(ue,"SPAN",{});var wo=a(S);I=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 Do=a(X);bt=r(Do,"Stable Diffusion"),Do.forEach(o),vt=r(k,`, AudioLDM
is a text-to-audio `),De=i(k,"EM",{});var Ao=a(De);yt=r(Ao,"latent diffusion model (LDM)"),Ao.forEach(o),wt=r(k," that learns continuous audio representations from "),Q=i(k,"A",{href:!0,rel:!0});var To=a(Q);Mt=r(To,"CLAP"),To.forEach(o),Dt=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),ze=c(e),he=i(e,"P",{});var Lo=a(he);At=r(Lo,"The abstract from the paper is:"),Lo.forEach(o),Ve=c(e),ge=i(e,"P",{});var $o=a(ge);K=i($o,"EM",{});var nt=a(K);Tt=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);Lt=r(Po,"https://audioldm.github.io"),Po.forEach(o),$t=r(nt,"."),nt.forEach(o),$o.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),j=i(e,"H2",{class:!0});var at=a(j);O=i(at,"A",{id:!0,class:!0,href:!0});var Eo=a(O);Ae=i(Eo,"SPAN",{});var ko=a(Ae);T(oe.$$.fragment,ko),ko.forEach(o),Eo.forEach(o),kt=c(at),Te=i(at,"SPAN",{});var So=a(Te);St=r(So,"Tips"),So.forEach(o),at.forEach(o),He=c(e),_e=i(e,"P",{});var Io=a(_e);It=r(Io,"When constructing a prompt, keep in mind:"),Io.forEach(o),We=c(e),q=i(e,"UL",{});var st=a(q);Le=i(st,"LI",{});var jo=a(Le);jt=r(jo,"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)."),jo.forEach(o),Ct=c(st),$e=i(st,"LI",{});var Co=a($e);Ut=r(Co,"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."),Co.forEach(o),st.forEach(o),Re=c(e),be=i(e,"P",{});var Uo=a(be);Nt=r(Uo,"During inference:"),Uo.forEach(o),Ye=c(e),z=i(e,"UL",{});var rt=a(z);C=i(rt,"LI",{});var ye=a(C);Gt=r(ye,"The "),Pe=i(ye,"EM",{});var No=a(Pe);Bt=r(No,"quality"),No.forEach(o),Jt=r(ye," of the predicted audio sample can be controlled by the "),xe=i(ye,"CODE",{});var Go=a(xe);Ot=r(Go,"num_inference_steps"),Go.forEach(o),qt=r(ye," argument; higher steps give higher quality audio at the expense of slower inference."),ye.forEach(o),zt=c(rt),U=i(rt,"LI",{});var we=a(U);Vt=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),T(V.$$.fragment,e),Qe=c(e),N=i(e,"H2",{class:!0});var lt=a(N);Z=i(lt,"A",{id:!0,class:!0,href:!0});var Oo=a(Z);Se=i(Oo,"SPAN",{});var qo=a(Se);T(ne.$$.fragment,qo),qo.forEach(o),Oo.forEach(o),Rt=c(lt),Ie=i(lt,"SPAN",{});var zo=a(Ie);Yt=r(zo,"AudioLDMPipeline"),zo.forEach(o),lt.forEach(o),Ke=c(e),b=i(e,"DIV",{class:!0});var D=a(b);T(ie.$$.fragment,D),Xt=c(D),je=i(D,"P",{});var Vo=a(je);Qt=r(Vo,"Pipeline for text-to-audio generation using AudioLDM."),Vo.forEach(o),Kt=c(D),ae=i(D,"P",{});var dt=a(ae);eo=r(dt,"This model inherits from "),ve=i(dt,"A",{href:!0});var Zo=a(ve);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(D),E=i(D,"DIV",{class:!0});var Me=a(E);T(se.$$.fragment,Me),io=c(Me),Ce=i(Me,"P",{});var Fo=a(Ce);ao=r(Fo,"The call function to the pipeline for generation."),Fo.forEach(o),so=c(Me),T(F.$$.fragment,Me),Me.forEach(o),ro=c(D),H=i(D,"DIV",{class:!0});var pt=a(H);T(re.$$.fragment,pt),lo=c(pt),le=i(pt,"P",{});var ct=a(le);po=r(ct,"Disable sliced VAE decoding. If "),Ue=i(ct,"CODE",{});var Ho=a(Ue);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(D),W=i(D,"DIV",{class:!0});var ut=a(W);T(de.$$.fragment,ut),mo=c(ut),Ne=i(ut,"P",{});var Wo=a(Ne);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),D.forEach(o),et=c(e),G=i(e,"H2",{class:!0});var ft=a(G);R=i(ft,"A",{id:!0,class:!0,href:!0});var Ro=a(R);Ge=i(Ro,"SPAN",{});var Yo=a(Ge);T(pe.$$.fragment,Yo),Yo.forEach(o),Ro.forEach(o),go=c(ft),Be=i(ft,"SPAN",{});var Xo=a(Be);_o=r(Xo,"StableDiffusionPipelineOutput"),Xo.forEach(o),ft.forEach(o),tt=c(e),B=i(e,"DIV",{class:!0});var mt=a(B);T(ce.$$.fragment,mt),bo=c(mt),Je=i(mt,"P",{});var Qo=a(Je);vo=r(Qo,"Output class for Stable Diffusion 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(O,"id","tips"),d(O,"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(O,"href","#tips"),d(j,"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(N,"class","relative group"),d(ve,"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(b,"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.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),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.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),d(G,"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,v),L(f,v,null),t(h,y),t(h,S),t(S,I),u(e,w,l),u(e,_,l),t(_,me),t(_,Y),t(Y,gt),t(_,_t),t(_,X),t(X,bt),t(_,vt),t(_,De),t(De,yt),t(_,wt),t(_,Q),t(Q,Mt),t(_,Dt),u(e,ze,l),u(e,he,l),t(he,At),u(e,Ve,l),u(e,ge,l),t(ge,K),t(K,Tt),t(K,ee),t(ee,Lt),t(K,$t),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,j,l),t(j,O),t(O,Ae),L(oe,Ae,null),t(j,kt),t(j,Te),t(Te,St),u(e,He,l),u(e,_e,l),t(_e,It),u(e,We,l),u(e,q,l),t(q,Le),t(Le,jt),t(q,Ct),t(q,$e),t($e,Ut),u(e,Re,l),u(e,be,l),t(be,Nt),u(e,Ye,l),u(e,z,l),t(z,C),t(C,Gt),t(C,Pe),t(Pe,Bt),t(C,Jt),t(C,xe),t(xe,Ot),t(C,qt),t(z,zt),t(z,U),t(U,Vt),t(U,Ee),t(Ee,Zt),t(U,Ft),t(U,ke),t(ke,Ht),t(U,Wt),u(e,Xe,l),L(V,e,l),u(e,Qe,l),u(e,N,l),t(N,Z),t(Z,Se),L(ne,Se,null),t(N,Rt),t(N,Ie),t(Ie,Yt),u(e,Ke,l),u(e,b,l),L(ie,b,null),t(b,Xt),t(b,je),t(je,Qt),t(b,Kt),t(b,ae),t(ae,eo),t(ae,ve),t(ve,to),t(ae,oo),t(b,no),t(b,E),L(se,E,null),t(E,io),t(E,Ce),t(Ce,ao),t(E,so),L(F,E,null),t(b,ro),t(b,H),L(re,H,null),t(H,lo),t(H,le),t(le,po),t(le,Ue),t(Ue,co),t(le,uo),t(b,fo),t(b,W),L(de,W,null),t(W,mo),t(W,Ne),t(Ne,ho),u(e,et,l),u(e,G,l),t(G,R),t(R,Ge),L(pe,Ge,null),t(G,go),t(G,Be),t(Be,_o),u(e,tt,l),u(e,B,l),L(ce,B,null),t(B,bo),t(B,Je),t(Je,vo),ot=!0},p(e,[l]){const ue={};l&2&&(ue.$$scope={dirty:l,ctx:e}),V.$set(ue);const Oe={};l&2&&(Oe.$$scope={dirty:l,ctx:e}),F.$set(Oe)},i(e){ot||($(f.$$.fragment,e),$(oe.$$.fragment,e),$(V.$$.fragment,e),$(ne.$$.fragment,e),$(ie.$$.fragment,e),$(se.$$.fragment,e),$(F.$$.fragment,e),$(re.$$.fragment,e),$(de.$$.fragment,e),$(pe.$$.fragment,e),$(ce.$$.fragment,e),ot=!0)},o(e){P(f.$$.fragment,e),P(oe.$$.fragment,e),P(V.$$.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(ze),e&&o(he),e&&o(Ve),e&&o(ge),e&&o(Ze),e&&o(J),e&&o(Fe),e&&o(j),x(oe),e&&o(He),e&&o(_e),e&&o(We),e&&o(q),e&&o(Re),e&&o(be),e&&o(Ye),e&&o(z),e&&o(Xe),x(V,e),e&&o(Qe),e&&o(N),x(ne),e&&o(Ke),e&&o(b),x(ie),x(se),x(F),x(re),x(de),e&&o(et),e&&o(G),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.pipelines.stable_diffusion.StableDiffusionPipelineOutput",title:"StableDiffusionPipelineOutput"}],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};
