import{S as Ko,i as en,s as tn,e as n,k as p,w as A,t as a,M as on,c as i,d as o,m as c,a as s,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 sn}from"../../../chunks/vendor-hf-doc-builder.js";import{T as an}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 mt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ln}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function dn(fe){let h,M,m,g,v,f,y,S;return{c(){h=n("p"),M=a("Make sure to check out the Schedulers "),m=n("a"),g=a("guide"),v=a(" to learn how to explore the tradeoff between scheduler speed and quality, and see the "),f=n("a"),y=a("reuse components across pipelines"),S=a(" section to learn how to efficiently load the same components into multiple pipelines."),this.h()},l(I){h=i(I,"P",{});var w=s(h);M=r(w,"Make sure to check out the Schedulers "),m=i(w,"A",{href:!0});var _=s(m);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 he=s(f);y=r(he,"reuse components across pipelines"),he.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(m,"href","/using-diffusers/schedulers"),d(f,"href","/using-diffusers/loading#reuse-components-across-pipelines")},m(I,w){u(I,h,w),t(h,M),t(h,m),t(m,g),t(h,v),t(h,f),t(f,y),t(h,S)},d(I){I&&o(h)}}}function pn(fe){let h,M,m,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(){h=n("p"),M=a("Examples:"),m=p(),A(g.$$.fragment)},l(f){h=i(f,"P",{});var y=s(h);M=r(y,"Examples:"),y.forEach(o),m=c(f),T(g.$$.fragment,f)},m(f,y){u(f,h,y),t(h,M),u(f,m,y),L(g,f,y),v=!0},p:sn,i(f){v||($(g.$$.fragment,f),v=!0)},o(f){P(g.$$.fragment,f),v=!1},d(f){f&&o(h),f&&o(m),x(g,f)}}}function cn(fe){let h,M,m,g,v,f,y,S,I,w,_,he,Y,gt,_t,X,bt,vt,De,yt,wt,Q,Mt,Dt,ze,me,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,se,eo,ve,to,oo,no,E,ae,io,Ce,so,ao,F,ro,H,re,lo,le,po,Ue,co,uo,fo,W,de,ho,Ne,mo,et,G,R,Ge,pe,go,Be,_o,tt,B,ce,bo,Je,vo,ot;return f=new mt({}),oe=new mt({}),V=new an({props:{$$slots:{default:[dn]},$$scope:{ctx:fe}}}),ne=new mt({}),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/v0.19.2/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/v4.31.0/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/v4.31.0/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/v0.19.2/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.19.2/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.19.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.19.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.19.2/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/v4.31.0/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/v0.19.2/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L51"}}),ae=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/v0.19.2/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.19.2/en/api/pipelines/stable_diffusion/inpaint#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/cross_attention.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.19.2/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L364",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.19.2/en/api/pipelines/stable_diffusion/inpaint#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/v0.19.2/en/api/pipelines/stable_diffusion/inpaint#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/v0.19.2/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/v0.19.2/src/diffusers/pipelines/audioldm/pipeline_audioldm.py#L97"}}),pe=new mt({}),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/v0.19.2/src/diffusers/pipelines/stable_diffusion/__init__.py#L22"}}),{c(){h=n("meta"),M=p(),m=n("h1"),g=n("a"),v=n("span"),A(f.$$.fragment),y=p(),S=n("span"),I=a("AudioLDM"),w=p(),_=n("p"),he=a("AudioLDM was proposed in "),Y=n("a"),gt=a("AudioLDM: Text-to-Audio Generation with Latent Diffusion Models"),_t=a(" by Haohe Liu et al. Inspired by "),X=n("a"),bt=a("Stable Diffusion"),vt=a(`, AudioLDM
is a text-to-audio `),De=n("em"),yt=a("latent diffusion model (LDM)"),wt=a(" that learns continuous audio representations from "),Q=n("a"),Mt=a("CLAP"),Dt=a(`
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(),me=n("p"),At=a("The abstract from the paper is:"),Ve=p(),ge=n("p"),K=n("em"),Tt=a("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=a("https://audioldm.github.io"),$t=a("."),Ze=p(),J=n("p"),Pt=a("The original codebase can be found at "),te=n("a"),xt=a("haoheliu/AudioLDM"),Et=a("."),Fe=p(),j=n("h2"),O=n("a"),Ae=n("span"),A(oe.$$.fragment),kt=p(),Te=n("span"),St=a("Tips"),He=p(),_e=n("p"),It=a("When constructing a prompt, keep in mind:"),We=p(),q=n("ul"),Le=n("li"),jt=a("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=a("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=a("During inference:"),Ye=p(),z=n("ul"),C=n("li"),Gt=a("The "),Pe=n("em"),Bt=a("quality"),Jt=a(" of the predicted audio sample can be controlled by the "),xe=n("code"),Ot=a("num_inference_steps"),qt=a(" argument; higher steps give higher quality audio at the expense of slower inference."),zt=p(),U=n("li"),Vt=a("The "),Ee=n("em"),Zt=a("length"),Ft=a(" of the predicted audio sample can be controlled by varying the "),ke=n("code"),Ht=a("audio_length_in_s"),Wt=a(" 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=a("AudioLDMPipeline"),Ke=p(),b=n("div"),A(ie.$$.fragment),Xt=p(),je=n("p"),Qt=a("Pipeline for text-to-audio generation using AudioLDM."),Kt=p(),se=n("p"),eo=a("This model inherits from "),ve=n("a"),to=a("DiffusionPipeline"),oo=a(`. 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(ae.$$.fragment),io=p(),Ce=n("p"),so=a("The call function to the pipeline for generation."),ao=p(),A(F.$$.fragment),ro=p(),H=n("div"),A(re.$$.fragment),lo=p(),le=n("p"),po=a("Disable sliced VAE decoding. If "),Ue=n("code"),co=a("enable_vae_slicing"),uo=a(` was previously enabled, this method will go back to
computing decoding in one step.`),fo=p(),W=n("div"),A(de.$$.fragment),ho=p(),Ne=n("p"),mo=a(`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=a("StableDiffusionPipelineOutput"),tt=p(),B=n("div"),A(ce.$$.fragment),bo=p(),Je=n("p"),vo=a("Output class for Stable Diffusion pipelines."),this.h()},l(e){const l=on('[data-svelte="svelte-1phssyn"]',document.head);h=i(l,"META",{name:!0,content:!0}),l.forEach(o),M=c(e),m=i(e,"H1",{class:!0});var ue=s(m);g=i(ue,"A",{id:!0,class:!0,href:!0});var Oe=s(g);v=i(Oe,"SPAN",{});var yo=s(v);T(f.$$.fragment,yo),yo.forEach(o),Oe.forEach(o),y=c(ue),S=i(ue,"SPAN",{});var wo=s(S);I=r(wo,"AudioLDM"),wo.forEach(o),ue.forEach(o),w=c(e),_=i(e,"P",{});var k=s(_);he=r(k,"AudioLDM was proposed in "),Y=i(k,"A",{href:!0,rel:!0});var Mo=s(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=s(X);bt=r(Do,"Stable Diffusion"),Do.forEach(o),vt=r(k,`, AudioLDM
is a text-to-audio `),De=i(k,"EM",{});var Ao=s(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=s(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),me=i(e,"P",{});var Lo=s(me);At=r(Lo,"The abstract from the paper is:"),Lo.forEach(o),Ve=c(e),ge=i(e,"P",{});var $o=s(ge);K=i($o,"EM",{});var nt=s(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=s(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=s(J);Pt=r(it,"The original codebase can be found at "),te=i(it,"A",{href:!0,rel:!0});var xo=s(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 st=s(j);O=i(st,"A",{id:!0,class:!0,href:!0});var Eo=s(O);Ae=i(Eo,"SPAN",{});var ko=s(Ae);T(oe.$$.fragment,ko),ko.forEach(o),Eo.forEach(o),kt=c(st),Te=i(st,"SPAN",{});var So=s(Te);St=r(So,"Tips"),So.forEach(o),st.forEach(o),He=c(e),_e=i(e,"P",{});var Io=s(_e);It=r(Io,"When constructing a prompt, keep in mind:"),Io.forEach(o),We=c(e),q=i(e,"UL",{});var at=s(q);Le=i(at,"LI",{});var jo=s(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(at),$e=i(at,"LI",{});var Co=s($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),at.forEach(o),Re=c(e),be=i(e,"P",{});var Uo=s(be);Nt=r(Uo,"During inference:"),Uo.forEach(o),Ye=c(e),z=i(e,"UL",{});var rt=s(z);C=i(rt,"LI",{});var ye=s(C);Gt=r(ye,"The "),Pe=i(ye,"EM",{});var No=s(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=s(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=s(U);Vt=r(we,"The "),Ee=i(we,"EM",{});var Bo=s(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=s(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=s(N);Z=i(lt,"A",{id:!0,class:!0,href:!0});var Oo=s(Z);Se=i(Oo,"SPAN",{});var qo=s(Se);T(ne.$$.fragment,qo),qo.forEach(o),Oo.forEach(o),Rt=c(lt),Ie=i(lt,"SPAN",{});var zo=s(Ie);Yt=r(zo,"AudioLDMPipeline"),zo.forEach(o),lt.forEach(o),Ke=c(e),b=i(e,"DIV",{class:!0});var D=s(b);T(ie.$$.fragment,D),Xt=c(D),je=i(D,"P",{});var Vo=s(je);Qt=r(Vo,"Pipeline for text-to-audio generation using AudioLDM."),Vo.forEach(o),Kt=c(D),se=i(D,"P",{});var dt=s(se);eo=r(dt,"This model inherits from "),ve=i(dt,"A",{href:!0});var Zo=s(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=s(E);T(ae.$$.fragment,Me),io=c(Me),Ce=i(Me,"P",{});var Fo=s(Ce);so=r(Fo,"The call function to the pipeline for generation."),Fo.forEach(o),ao=c(Me),T(F.$$.fragment,Me),Me.forEach(o),ro=c(D),H=i(D,"DIV",{class:!0});var pt=s(H);T(re.$$.fragment,pt),lo=c(pt),le=i(pt,"P",{});var ct=s(le);po=r(ct,"Disable sliced VAE decoding. If "),Ue=i(ct,"CODE",{});var Ho=s(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=s(W);T(de.$$.fragment,ut),ho=c(ut),Ne=i(ut,"P",{});var Wo=s(Ne);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),D.forEach(o),et=c(e),G=i(e,"H2",{class:!0});var ft=s(G);R=i(ft,"A",{id:!0,class:!0,href:!0});var Ro=s(R);Ge=i(Ro,"SPAN",{});var Yo=s(Ge);T(pe.$$.fragment,Yo),Yo.forEach(o),Ro.forEach(o),go=c(ft),Be=i(ft,"SPAN",{});var Xo=s(Be);_o=r(Xo,"StableDiffusionPipelineOutput"),Xo.forEach(o),ft.forEach(o),tt=c(e),B=i(e,"DIV",{class:!0});var ht=s(B);T(ce.$$.fragment,ht),bo=c(ht),Je=i(ht,"P",{});var Qo=s(Je);vo=r(Qo,"Output class for Stable Diffusion pipelines."),Qo.forEach(o),ht.forEach(o),this.h()},h(){d(h,"name","hf:doc:metadata"),d(h,"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(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(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/v0.19.2/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,h),u(e,M,l),u(e,m,l),t(m,g),t(g,v),L(f,v,null),t(m,y),t(m,S),t(S,I),u(e,w,l),u(e,_,l),t(_,he),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,me,l),t(me,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,se),t(se,eo),t(se,ve),t(ve,to),t(se,oo),t(b,no),t(b,E),L(ae,E,null),t(E,io),t(E,Ce),t(Ce,so),t(E,ao),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,ho),t(W,Ne),t(Ne,mo),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),$(ae.$$.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(ae.$$.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(ze),e&&o(me),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(ae),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(h){super();en(this,h,fn,cn,tn,{})}}export{yn as default,un as metadata};
