import{S as Id,i as Jd,s as qd,e as n,k as l,w as _,t as i,M as Sd,c as a,d as o,m as c,a as s,x as v,h as r,b as d,G as e,g as m,y as b,q as M,o as w,B as y,v as Gd,L as Cd}from"../../../chunks/vendor-hf-doc-builder.js";import{T as Fd}from"../../../chunks/Tip-hf-doc-builder.js";import{D as q}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as Bd}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as X}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Pd}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Zd(ce){let f,L,g,h,x,u,T,R;return{c(){f=n("p"),L=i("Make sure to check out the Schedulers "),g=n("a"),h=i("guide"),x=i(` to learn how to explore the tradeoff between
scheduler speed and quality, and see the `),u=n("a"),T=i("reuse components across pipelines"),R=i(`
section to learn how to efficiently load the same components into multiple pipelines.`),this.h()},l(V){f=a(V,"P",{});var j=s(f);L=r(j,"Make sure to check out the Schedulers "),g=a(j,"A",{href:!0});var B=s(g);h=r(B,"guide"),B.forEach(o),x=r(j,` to learn how to explore the tradeoff between
scheduler speed and quality, and see the `),u=a(j,"A",{href:!0});var Mt=s(u);T=r(Mt,"reuse components across pipelines"),Mt.forEach(o),R=r(j,`
section to learn how to efficiently load the same components into multiple pipelines.`),j.forEach(o),this.h()},h(){d(g,"href","/using-diffusers/schedulers"),d(u,"href","/using-diffusers/loading#reuse-components-across-pipelines")},m(V,j){m(V,f,j),e(f,L),e(f,g),e(g,h),e(f,x),e(f,u),e(u,T),e(f,R)},d(V){V&&o(f)}}}function Od(ce){let f,L,g,h,x;return h=new Bd({props:{code:"aW1wb3J0JTIwc2NpcHklMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdWRpb0xETTJQaXBlbGluZSUwQSUwQXJlcG9faWQlMjAlM0QlMjAlMjJjdnNzcCUyRmF1ZGlvbGRtMiUyMiUwQXBpcGUlMjAlM0QlMjBBdWRpb0xETTJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQocmVwb19pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMGRlZmluZSUyMHRoZSUyMHByb21wdHMlMEFwcm9tcHQlMjAlM0QlMjAlMjJUaGUlMjBzb3VuZCUyMG9mJTIwYSUyMGhhbW1lciUyMGhpdHRpbmclMjBhJTIwd29vZGVuJTIwc3VyZmFjZS4lMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJMb3clMjBxdWFsaXR5LiUyMiUwQSUwQSUyMyUyMHNldCUyMHRoZSUyMHNlZWQlMjBmb3IlMjBnZW5lcmF0b3IlMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoJTIyY3VkYSUyMikubWFudWFsX3NlZWQoMCklMEElMEElMjMlMjBydW4lMjB0aGUlMjBnZW5lcmF0aW9uJTBBYXVkaW8lMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyMDAlMkMlMEElMjAlMjAlMjAlMjBhdWRpb19sZW5ndGhfaW5fcyUzRDEwLjAlMkMlMEElMjAlMjAlMjAlMjBudW1fd2F2ZWZvcm1zX3Blcl9wcm9tcHQlM0QzJTJDJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTBBKS5hdWRpb3MlMEElMEElMjMlMjBzYXZlJTIwdGhlJTIwYmVzdCUyMGF1ZGlvJTIwc2FtcGxlJTIwKGluZGV4JTIwMCklMjBhcyUyMGElMjAud2F2JTIwZmlsZSUwQXNjaXB5LmlvLndhdmZpbGUud3JpdGUoJTIydGVjaG5vLndhdiUyMiUyQyUyMHJhdGUlM0QxNjAwMCUyQyUyMGRhdGElM0RhdWRpbyU1QjAlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> scipy
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AudioLDM2Pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>repo_id = <span class="hljs-string">&quot;cvssp/audioldm2&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save the best audio sample (index 0) 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[<span class="hljs-number">0</span>])`}}),{c(){f=n("p"),L=i("Examples:"),g=l(),_(h.$$.fragment)},l(u){f=a(u,"P",{});var T=s(f);L=r(T,"Examples:"),T.forEach(o),g=c(u),v(h.$$.fragment,u)},m(u,T){m(u,f,T),e(f,L),m(u,g,T),b(h,u,T),x=!0},p:Cd,i(u){x||(M(h.$$.fragment,u),x=!0)},o(u){w(h.$$.fragment,u),x=!1},d(u){u&&o(f),u&&o(g),y(h,u)}}}function Wd(ce){let f,L,g,h,x;return h=new Bd({props:{code:"aW1wb3J0JTIwc2NpcHklMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdWRpb0xETTJQaXBlbGluZSUwQSUwQXJlcG9faWQlMjAlM0QlMjAlMjJjdnNzcCUyRmF1ZGlvbGRtMiUyMiUwQXBpcGUlMjAlM0QlMjBBdWRpb0xETTJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQocmVwb19pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMEdldCUyMHRleHQlMjBlbWJlZGRpbmclMjB2ZWN0b3JzJTBBcHJvbXB0X2VtYmVkcyUyQyUyMGF0dGVudGlvbl9tYXNrJTJDJTIwZ2VuZXJhdGVkX3Byb21wdF9lbWJlZHMlMjAlM0QlMjBwaXBlLmVuY29kZV9wcm9tcHQoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyVGVjaG5vJTIwbXVzaWMlMjB3aXRoJTIwYSUyMHN0cm9uZyUyQyUyMHVwYmVhdCUyMHRlbXBvJTIwYW5kJTIwaGlnaCUyMG1lbG9kaWMlMjByaWZmcyUyMiUyQyUwQSUyMCUyMCUyMCUyMGRldmljZSUzRCUyMmN1ZGElMjIlMkMlMEElMjAlMjAlMjAlMjBkb19jbGFzc2lmaWVyX2ZyZWVfZ3VpZGFuY2UlM0RUcnVlJTJDJTBBKSUwQSUwQSUyMyUyMFBhc3MlMjB0ZXh0JTIwZW1iZWRkaW5ncyUyMHRvJTIwcGlwZWxpbmUlMjBmb3IlMjB0ZXh0LWNvbmRpdGlvbmFsJTIwYXVkaW8lMjBnZW5lcmF0aW9uJTBBYXVkaW8lMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdF9lbWJlZHMlM0Rwcm9tcHRfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRlZF9wcm9tcHRfZW1iZWRzJTNEZ2VuZXJhdGVkX3Byb21wdF9lbWJlZHMlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjAwJTJDJTBBJTIwJTIwJTIwJTIwYXVkaW9fbGVuZ3RoX2luX3MlM0QxMC4wJTJDJTBBKS5hdWRpb3MlNUIwJTVEJTBBJTBBJTIzJTIwc2F2ZSUyMGdlbmVyYXRlZCUyMGF1ZGlvJTIwc2FtcGxlJTBBc2NpcHkuaW8ud2F2ZmlsZS53cml0ZSglMjJ0ZWNobm8ud2F2JTIyJTJDJTIwcmF0ZSUzRDE2MDAwJTJDJTIwZGF0YSUzRGF1ZGlvKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> scipy
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AudioLDM2Pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>repo_id = <span class="hljs-string">&quot;cvssp/audioldm2&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Get text embedding vectors</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, attention_mask, generated_prompt_embeds = pipe.encode_prompt(
<span class="hljs-meta">... </span>    prompt=<span class="hljs-string">&quot;Techno music with a strong, upbeat tempo and high melodic riffs&quot;</span>,
<span class="hljs-meta">... </span>    device=<span class="hljs-string">&quot;cuda&quot;</span>,
<span class="hljs-meta">... </span>    do_classifier_free_guidance=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Pass text embeddings to pipeline for text-conditional audio generation</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>audio = pipe(
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    attention_mask=attention_mask,
<span class="hljs-meta">... </span>    generated_prompt_embeds=generated_prompt_embeds,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">200</span>,
<span class="hljs-meta">... </span>    audio_length_in_s=<span class="hljs-number">10.0</span>,
<span class="hljs-meta">... </span>).audios[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save generated audio sample</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(){f=n("p"),L=i("Example:"),g=l(),_(h.$$.fragment)},l(u){f=a(u,"P",{});var T=s(f);L=r(T,"Example:"),T.forEach(o),g=c(u),v(h.$$.fragment,u)},m(u,T){m(u,f,T),e(f,L),m(u,g,T),b(h,u,T),x=!0},p:Cd,i(u){x||(M(h.$$.fragment,u),x=!0)},o(u){w(h.$$.fragment,u),x=!1},d(u){u&&o(f),u&&o(g),y(h,u)}}}function zd(ce){let f,L,g,h,x,u,T,R,V,j,B,Mt,Ne,Xn,Rn,Ro,D,Vn,Pe,Hn,Yn,Jt,Kn,ea,Ce,ta,oa,Be,na,aa,Ie,sa,ia,Je,ra,da,qt,la,ca,qe,pa,ma,St,ua,fa,Vo,wt,ha,Ho,yt,Gt,ga,Yo,S,_a,Se,va,ba,Ge,Ma,wa,Ko,H,pe,Ft,Fe,ya,Zt,Da,en,Y,me,Ot,Ze,Ta,Wt,Aa,tn,Dt,ka,on,Tt,xa,nn,ue,zt,$,Qt,La,Ea,Xt,ja,$a,Rt,Ua,Na,Vt,Pa,Ca,Ht,Ba,Ia,K,U,Yt,Oe,Ja,qa,Kt,Sa,Ga,eo,Fa,Za,to,Oa,Wa,oo,za,Qa,N,no,We,Xa,Ra,ao,Va,Ha,so,Ya,Ka,io,es,ts,ro,os,ns,P,lo,ze,as,ss,co,is,rs,po,ds,ls,mo,cs,ps,uo,ms,an,ee,fe,fo,Qe,us,ho,fs,sn,G,go,hs,gs,_o,_s,vs,Xe,bs,vo,Ms,ws,rn,te,he,bo,Re,ys,Mo,Ds,dn,ge,oe,Ts,wo,As,ks,yo,xs,Ls,Es,ne,js,Do,$s,Us,To,Ns,Ps,ln,ae,_e,Ao,Ve,Cs,ko,Bs,cn,ve,xo,Is,Js,He,qs,Lo,Ss,Gs,pn,be,Fs,Ye,Zs,Os,mn,Me,un,se,we,Eo,Ke,Ws,jo,zs,fn,A,et,Qs,$o,Xs,Rs,tt,Vs,At,Hs,Ys,Ks,F,ot,ei,Uo,ti,oi,ye,ni,De,nt,ai,at,si,No,ii,ri,di,Te,st,li,Po,ci,pi,Z,it,mi,Co,ui,fi,Ae,hi,ke,rt,gi,Bo,_i,hn,ie,xe,Io,dt,vi,Jo,bi,gn,I,lt,Mi,ct,wi,qo,yi,Di,Ti,kt,pt,_n,re,Le,So,mt,Ai,Go,ki,vn,C,ut,xi,J,Li,xt,Ei,ji,Fo,$i,Ui,Zo,Ni,Pi,Ci,ft,Bi,Lt,Ii,Ji,qi,Ee,ht,Si,gt,Gi,Et,Fi,Zi,bn,de,je,Oo,_t,Oi,Wo,Wi,Mn,le,vt,zi,zo,Qi,wn;return u=new X({}),Fe=new X({}),Ze=new X({}),Qe=new X({}),Re=new X({}),Ve=new X({}),Me=new Fd({props:{$$slots:{default:[Zd]},$$scope:{ctx:ce}}}),Ke=new X({}),et=new q({props:{name:"class diffusers.AudioLDM2Pipeline",anchor:"diffusers.AudioLDM2Pipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": ClapModel"},{name:"text_encoder_2",val:": T5EncoderModel"},{name:"projection_model",val:": AudioLDM2ProjectionModel"},{name:"language_model",val:": GPT2Model"},{name:"tokenizer",val:": typing.Union[transformers.models.roberta.tokenization_roberta.RobertaTokenizer, transformers.models.roberta.tokenization_roberta_fast.RobertaTokenizerFast]"},{name:"tokenizer_2",val:": typing.Union[transformers.models.t5.tokenization_t5.T5Tokenizer, transformers.models.t5.tokenization_t5_fast.T5TokenizerFast]"},{name:"feature_extractor",val:": ClapFeatureExtractor"},{name:"unet",val:": AudioLDM2UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"vocoder",val:": SpeechT5HifiGan"}],parametersDescription:[{anchor:"diffusers.AudioLDM2Pipeline.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.AudioLDM2Pipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>ClapModel</code>) &#x2014;
First frozen text-encoder. AudioLDM2 uses the joint audio-text embedding model
<a href="https://huggingface.co/docs/transformers/model_doc/clap#transformers.CLAPTextModelWithProjection" rel="nofollow">CLAP</a>,
specifically the <a href="https://huggingface.co/laion/clap-htsat-unfused" rel="nofollow">laion/clap-htsat-unfused</a> variant. The
text branch is used to encode the text prompt to a prompt embedding. The full audio-text model is used to
rank generated waveforms against the text prompt by computing similarity scores.`,name:"text_encoder"},{anchor:"diffusers.AudioLDM2Pipeline.text_encoder_2",description:`<strong>text_encoder_2</strong> (<code>T5EncoderModel</code>) &#x2014;
Second frozen text-encoder. AudioLDM2 uses the encoder of
<a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically the
<a href="https://huggingface.co/google/flan-t5-large" rel="nofollow">google/flan-t5-large</a> variant.`,name:"text_encoder_2"},{anchor:"diffusers.AudioLDM2Pipeline.projection_model",description:`<strong>projection_model</strong> (<a href="/docs/diffusers/v0.21.0/en/api/pipelines/audioldm2#diffusers.AudioLDM2ProjectionModel">AudioLDM2ProjectionModel</a>) &#x2014;
A trained model used to linearly project the hidden-states from the first and second text encoder models
and insert learned SOS and EOS token embeddings. The projected hidden-states from the two text encoders are
concatenated to give the input to the language model.`,name:"projection_model"},{anchor:"diffusers.AudioLDM2Pipeline.language_model",description:`<strong>language_model</strong> (<code>GPT2Model</code>) &#x2014;
An auto-regressive language model used to generate a sequence of hidden-states conditioned on the projected
outputs from the two text encoders.`,name:"language_model"},{anchor:"diffusers.AudioLDM2Pipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>RobertaTokenizer</code>) &#x2014;
Tokenizer to tokenize text for the first frozen text-encoder.`,name:"tokenizer"},{anchor:"diffusers.AudioLDM2Pipeline.tokenizer_2",description:`<strong>tokenizer_2</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer to tokenize text for the second frozen text-encoder.`,name:"tokenizer_2"},{anchor:"diffusers.AudioLDM2Pipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>ClapFeatureExtractor</code>) &#x2014;
Feature extractor to pre-process generated audio waveforms to log-mel spectrograms for automatic scoring.`,name:"feature_extractor"},{anchor:"diffusers.AudioLDM2Pipeline.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.AudioLDM2Pipeline.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.AudioLDM2Pipeline.vocoder",description:`<strong>vocoder</strong> (<code>SpeechT5HifiGan</code>) &#x2014;
Vocoder of class <code>SpeechT5HifiGan</code> to convert the mel-spectrogram latents to the final audio waveform.`,name:"vocoder"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py#L103"}}),ot=new q({props:{name:"__call__",anchor:"diffusers.AudioLDM2Pipeline.__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 = 200"},{name:"guidance_scale",val:": float = 3.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:"generated_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_generated_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"negative_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"max_new_tokens",val:": typing.Optional[int] = 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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__call__.audio_length_in_s",description:`<strong>audio_length_in_s</strong> (<code>int</code>, <em>optional</em>, defaults to 10.24) &#x2014;
The length of the generated audio sample in seconds.`,name:"audio_length_in_s"},{anchor:"diffusers.AudioLDM2Pipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 200) &#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.AudioLDM2Pipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 3.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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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. If <code>num_waveforms_per_prompt &gt; 1</code>, then automatic
scoring is performed between the generated outputs and the text prompt. This scoring ranks the
generated waveforms based on their cosine similarity with the text input in the joint text-audio
embedding space.`,name:"num_waveforms_per_prompt"},{anchor:"diffusers.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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 spectrogram
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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__call__.generated_prompt_embeds",description:`<strong>generated_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings from the GPT2 langauge model. Can be used to easily tweak text inputs,
<em>e.g.</em> prompt weighting. If not provided, text embeddings will be generated from <code>prompt</code> input
argument.`,name:"generated_prompt_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.__call__.negative_generated_prompt_embeds",description:`<strong>negative_generated_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings from the GPT2 language model. Can be used to easily tweak text
inputs, <em>e.g.</em> prompt weighting. If not provided, negative_prompt_embeds will be computed from
<code>negative_prompt</code> input argument.`,name:"negative_generated_prompt_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-computed attention mask to be applied to the <code>prompt_embeds</code>. If not provided, attention mask will
be computed from <code>prompt</code> input argument.`,name:"attention_mask"},{anchor:"diffusers.AudioLDM2Pipeline.__call__.negative_attention_mask",description:`<strong>negative_attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-computed attention mask to be applied to the <code>negative_prompt_embeds</code>. If not provided, attention
mask will be computed from <code>negative_prompt</code> input argument.`,name:"negative_attention_mask"},{anchor:"diffusers.AudioLDM2Pipeline.__call__.max_new_tokens",description:`<strong>max_new_tokens</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Number of new tokens to generate with the GPT2 language model. If not provided, number of tokens will
be taken from the config of the model.`,name:"max_new_tokens"},{anchor:"diffusers.AudioLDM2Pipeline.__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/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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.AudioLDM2Pipeline.__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 audio. Choose between <code>&quot;np&quot;</code> to return a NumPy <code>np.ndarray</code> or
<code>&quot;pt&quot;</code> to return a PyTorch <code>torch.Tensor</code> object. Set to <code>&quot;latent&quot;</code> to return the latent diffusion
model (LDM) output.`,name:"output_type"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py#L732",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.21.0/en/api/pipelines/stable_diffusion/img2img#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.21.0/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),ye=new Pd({props:{anchor:"diffusers.AudioLDM2Pipeline.__call__.example",$$slots:{default:[Od]},$$scope:{ctx:ce}}}),nt=new q({props:{name:"disable_vae_slicing",anchor:"diffusers.AudioLDM2Pipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py#L185"}}),st=new q({props:{name:"enable_vae_slicing",anchor:"diffusers.AudioLDM2Pipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py#L177"}}),it=new q({props:{name:"encode_prompt",anchor:"diffusers.AudioLDM2Pipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:""},{name:"num_waveforms_per_prompt",val:""},{name:"do_classifier_free_guidance",val:""},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"generated_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_generated_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"negative_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"max_new_tokens",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.device",description:`<strong>device</strong> (<code>torch.device</code>) &#x2014;
torch device`,name:"device"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.num_waveforms_per_prompt",description:`<strong>num_waveforms_per_prompt</strong> (<code>int</code>) &#x2014;
number of waveforms that should be generated per prompt`,name:"num_waveforms_per_prompt"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the audio generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-computed text embeddings from the Flan T5 model. Can be used to easily tweak text inputs, <em>e.g.</em>
prompt weighting. If not provided, text embeddings will be computed from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-computed negative text embeddings from the Flan T5 model. Can be used to easily tweak text inputs,
<em>e.g.</em> prompt weighting. If not provided, negative_prompt_embeds will be computed from
<code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.generated_prompt_embeds",description:`<strong>generated_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings from the GPT2 langauge model. Can be used to easily tweak text inputs,
<em>e.g.</em> prompt weighting. If not provided, text embeddings will be generated from <code>prompt</code> input
argument.`,name:"generated_prompt_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.negative_generated_prompt_embeds",description:`<strong>negative_generated_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings from the GPT2 language model. Can be used to easily tweak text
inputs, <em>e.g.</em> prompt weighting. If not provided, negative_prompt_embeds will be computed from
<code>negative_prompt</code> input argument.`,name:"negative_generated_prompt_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-computed attention mask to be applied to the <code>prompt_embeds</code>. If not provided, attention mask will
be computed from <code>prompt</code> input argument.`,name:"attention_mask"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.negative_attention_mask",description:`<strong>negative_attention_mask</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Pre-computed attention mask to be applied to the <code>negative_prompt_embeds</code>. If not provided, attention
mask will be computed from <code>negative_prompt</code> input argument.`,name:"negative_attention_mask"},{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.max_new_tokens",description:`<strong>max_new_tokens</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
The number of new tokens to generate with the GPT2 language model.`,name:"max_new_tokens"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py#L270",returnDescription:`
<p>Text embeddings from the Flan T5 model.
attention_mask (<code>torch.LongTensor</code>):
Attention mask to be applied to the <code>prompt_embeds</code>.
generated_prompt_embeds (<code>torch.FloatTensor</code>):
Text embeddings generated from the GPT2 langauge model.</p>
`,returnType:`
<p>prompt_embeds (<code>torch.FloatTensor</code>)</p>
`}}),Ae=new Pd({props:{anchor:"diffusers.AudioLDM2Pipeline.encode_prompt.example",$$slots:{default:[Wd]},$$scope:{ctx:ce}}}),rt=new q({props:{name:"generate_language_model",anchor:"diffusers.AudioLDM2Pipeline.generate_language_model",parameters:[{name:"inputs_embeds",val:": Tensor = None"},{name:"max_new_tokens",val:": int = 8"},{name:"**model_kwargs",val:""}],parametersDescription:[{anchor:"diffusers.AudioLDM2Pipeline.generate_language_model.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
The sequence used as a prompt for the generation.`,name:"inputs_embeds"},{anchor:"diffusers.AudioLDM2Pipeline.generate_language_model.max_new_tokens",description:`<strong>max_new_tokens</strong> (<code>int</code>) &#x2014;
Number of new tokens to generate.`,name:"max_new_tokens"},{anchor:"diffusers.AudioLDM2Pipeline.generate_language_model.model_kwargs",description:`<strong>model_kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Ad hoc parametrization of additional model-specific kwargs that will be forwarded to the <code>forward</code>
function of the model.`,name:"model_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py#L229",returnDescription:`
<p>The sequence of generated hidden-states.</p>
`,returnType:`
<p><code>inputs_embeds (</code>torch.FloatTensor<code>of shape</code>(batch_size, sequence_length, hidden_size)\`)</p>
`}}),dt=new X({}),lt=new q({props:{name:"class diffusers.AudioLDM2ProjectionModel",anchor:"diffusers.AudioLDM2ProjectionModel",parameters:[{name:"text_encoder_dim",val:""},{name:"text_encoder_1_dim",val:""},{name:"langauge_model_dim",val:""}],parametersDescription:[{anchor:"diffusers.AudioLDM2ProjectionModel.text_encoder_dim",description:`<strong>text_encoder_dim</strong> (<code>int</code>) &#x2014;
Dimensionality of the text embeddings from the first text encoder (CLAP).`,name:"text_encoder_dim"},{anchor:"diffusers.AudioLDM2ProjectionModel.text_encoder_1_dim",description:`<strong>text_encoder_1_dim</strong> (<code>int</code>) &#x2014;
Dimensionality of the text embeddings from the second text encoder (T5 or VITS).`,name:"text_encoder_1_dim"},{anchor:"diffusers.AudioLDM2ProjectionModel.langauge_model_dim",description:`<strong>langauge_model_dim</strong> (<code>int</code>) &#x2014;
Dimensionality of the text embeddings from the language model (GPT2).`,name:"langauge_model_dim"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/modeling_audioldm2.py#L82"}}),pt=new q({props:{name:"forward",anchor:"diffusers.AudioLDM2ProjectionModel.forward",parameters:[{name:"hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"hidden_states_1",val:": typing.Optional[torch.FloatTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask_1",val:": typing.Optional[torch.LongTensor] = None"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/modeling_audioldm2.py#L111"}}),mt=new X({}),ut=new q({props:{name:"class diffusers.AudioLDM2UNet2DConditionModel",anchor:"diffusers.AudioLDM2UNet2DConditionModel",parameters:[{name:"sample_size",val:": typing.Optional[int] = None"},{name:"in_channels",val:": int = 4"},{name:"out_channels",val:": int = 4"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"down_block_types",val:": typing.Tuple[str] = ('CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'DownBlock2D')"},{name:"mid_block_type",val:": typing.Optional[str] = 'UNetMidBlock2DCrossAttn'"},{name:"up_block_types",val:": typing.Tuple[str] = ('UpBlock2D', 'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D')"},{name:"only_cross_attention",val:": typing.Union[bool, typing.Tuple[bool]] = False"},{name:"block_out_channels",val:": typing.Tuple[int] = (320, 640, 1280, 1280)"},{name:"layers_per_block",val:": typing.Union[int, typing.Tuple[int]] = 2"},{name:"downsample_padding",val:": int = 1"},{name:"mid_block_scale_factor",val:": float = 1"},{name:"act_fn",val:": str = 'silu'"},{name:"norm_num_groups",val:": typing.Optional[int] = 32"},{name:"norm_eps",val:": float = 1e-05"},{name:"cross_attention_dim",val:": typing.Union[int, typing.Tuple[int]] = 1280"},{name:"transformer_layers_per_block",val:": typing.Union[int, typing.Tuple[int]] = 1"},{name:"attention_head_dim",val:": typing.Union[int, typing.Tuple[int]] = 8"},{name:"num_attention_heads",val:": typing.Union[int, typing.Tuple[int], NoneType] = None"},{name:"use_linear_projection",val:": bool = False"},{name:"class_embed_type",val:": typing.Optional[str] = None"},{name:"num_class_embeds",val:": typing.Optional[int] = None"},{name:"upcast_attention",val:": bool = False"},{name:"resnet_time_scale_shift",val:": str = 'default'"},{name:"time_embedding_type",val:": str = 'positional'"},{name:"time_embedding_dim",val:": typing.Optional[int] = None"},{name:"time_embedding_act_fn",val:": typing.Optional[str] = None"},{name:"timestep_post_act",val:": typing.Optional[str] = None"},{name:"time_cond_proj_dim",val:": typing.Optional[int] = None"},{name:"conv_in_kernel",val:": int = 3"},{name:"conv_out_kernel",val:": int = 3"},{name:"projection_class_embeddings_input_dim",val:": typing.Optional[int] = None"},{name:"class_embeddings_concat",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.AudioLDM2UNet2DConditionModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code> or <code>Tuple[int, int]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Height and width of input/output sample.`,name:"sample_size"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; Number of channels in the input sample.",name:"in_channels"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.out_channels",description:"<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; Number of channels in the output.",name:"out_channels"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.freq_shift",description:"<strong>freq_shift</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014; The frequency shift to apply to the time embedding.",name:"freq_shift"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.down_block_types",description:`<strong>down_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;CrossAttnDownBlock2D&quot;, &quot;CrossAttnDownBlock2D&quot;, &quot;CrossAttnDownBlock2D&quot;, &quot;DownBlock2D&quot;)</code>) &#x2014;
The tuple of downsample blocks to use.`,name:"down_block_types"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.mid_block_type",description:`<strong>mid_block_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;UNetMidBlock2DCrossAttn&quot;</code>) &#x2014;
Block type for middle of UNet, it can only be <code>UNetMidBlock2DCrossAttn</code> for AudioLDM2.`,name:"mid_block_type"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.up_block_types",description:`<strong>up_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;UpBlock2D&quot;, &quot;CrossAttnUpBlock2D&quot;, &quot;CrossAttnUpBlock2D&quot;, &quot;CrossAttnUpBlock2D&quot;)</code>) &#x2014;
The tuple of upsample blocks to use.`,name:"up_block_types"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.only_cross_attention",description:`<strong>only_cross_attention</strong> (<code>bool</code> or <code>Tuple[bool]</code>, <em>optional</em>, default to <code>False</code>) &#x2014;
Whether to include self-attention in the basic transformer blocks, see
<code>BasicTransformerBlock</code>.`,name:"only_cross_attention"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(320, 640, 1280, 1280)</code>) &#x2014;
The tuple of output channels for each block.`,name:"block_out_channels"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.layers_per_block",description:"<strong>layers_per_block</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014; The number of layers per block.",name:"layers_per_block"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.downsample_padding",description:"<strong>downsample_padding</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The padding to use for the downsampling convolution.",name:"downsample_padding"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.mid_block_scale_factor",description:"<strong>mid_block_scale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014; The scale factor to use for the mid block.",name:"mid_block_scale_factor"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.act_fn",description:"<strong>act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014; The activation function to use.",name:"act_fn"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.norm_num_groups",description:`<strong>norm_num_groups</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014; The number of groups to use for the normalization.
If <code>None</code>, normalization and activation layers is skipped in post-processing.`,name:"norm_num_groups"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.norm_eps",description:"<strong>norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014; The epsilon to use for the normalization.",name:"norm_eps"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>, defaults to 1280) &#x2014;
The dimension of the cross attention features.`,name:"cross_attention_dim"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.transformer_layers_per_block",description:`<strong>transformer_layers_per_block</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of transformer blocks of type <code>BasicTransformerBlock</code>. Only relevant for
<code>CrossAttnDownBlock2D</code>, <code>CrossAttnUpBlock2D</code>,
<code>UNetMidBlock2DCrossAttn</code>.`,name:"transformer_layers_per_block"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014; The dimension of the attention heads.",name:"attention_head_dim"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of attention heads. If not defined, defaults to <code>attention_head_dim</code>`,name:"num_attention_heads"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.resnet_time_scale_shift",description:`<strong>resnet_time_scale_shift</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;default&quot;</code>) &#x2014; Time scale shift config
for ResNet blocks (see <code>ResnetBlock2D</code>). Choose from <code>default</code> or <code>scale_shift</code>.`,name:"resnet_time_scale_shift"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.class_embed_type",description:`<strong>class_embed_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The type of class embedding to use which is ultimately summed with the time embeddings. Choose from <code>None</code>,
<code>&quot;timestep&quot;</code>, <code>&quot;identity&quot;</code>, <code>&quot;projection&quot;</code>, or <code>&quot;simple_projection&quot;</code>.`,name:"class_embed_type"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.num_class_embeds",description:`<strong>num_class_embeds</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Input dimension of the learnable embedding matrix to be projected to <code>time_embed_dim</code>, when performing
class conditioning with <code>class_embed_type</code> equal to <code>None</code>.`,name:"num_class_embeds"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.time_embedding_type",description:`<strong>time_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>positional</code>) &#x2014;
The type of position embedding to use for timesteps. Choose from <code>positional</code> or <code>fourier</code>.`,name:"time_embedding_type"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.time_embedding_dim",description:`<strong>time_embedding_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An optional override for the dimension of the projected time embedding.`,name:"time_embedding_dim"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.time_embedding_act_fn",description:`<strong>time_embedding_act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Optional activation function to use only once on the time embeddings before they are passed to the rest of
the UNet. Choose from <code>silu</code>, <code>mish</code>, <code>gelu</code>, and <code>swish</code>.`,name:"time_embedding_act_fn"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.timestep_post_act",description:`<strong>timestep_post_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The second activation function to use in timestep embedding. Choose from <code>silu</code>, <code>mish</code> and <code>gelu</code>.`,name:"timestep_post_act"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.time_cond_proj_dim",description:`<strong>time_cond_proj_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The dimension of <code>cond_proj</code> layer in the timestep embedding.`,name:"time_cond_proj_dim"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.conv_in_kernel",description:"<strong>conv_in_kernel</strong> (<code>int</code>, <em>optional</em>, default to <code>3</code>) &#x2014; The kernel size of <code>conv_in</code> layer.",name:"conv_in_kernel"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.conv_out_kernel",description:"<strong>conv_out_kernel</strong> (<code>int</code>, <em>optional</em>, default to <code>3</code>) &#x2014; The kernel size of <code>conv_out</code> layer.",name:"conv_out_kernel"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.projection_class_embeddings_input_dim",description:`<strong>projection_class_embeddings_input_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The dimension of the <code>class_labels</code> input when
<code>class_embed_type=&quot;projection&quot;</code>. Required when <code>class_embed_type=&quot;projection&quot;</code>.`,name:"projection_class_embeddings_input_dim"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.class_embeddings_concat",description:`<strong>class_embeddings_concat</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Whether to concatenate the time
embeddings with the class embeddings.`,name:"class_embeddings_concat"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/modeling_audioldm2.py#L148"}}),ht=new q({props:{name:"forward",anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Union[torch.Tensor, float, int]"},{name:"encoder_hidden_states",val:": Tensor"},{name:"class_labels",val:": typing.Optional[torch.Tensor] = None"},{name:"timestep_cond",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"},{name:"encoder_hidden_states_1",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask_1",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The noisy input tensor with the following shape <code>(batch, channel, height, width)</code>.`,name:"sample"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.timestep",description:"<strong>timestep</strong> (<code>torch.FloatTensor</code> or <code>float</code> or <code>int</code>) &#x2014; The number of timesteps to denoise an input.",name:"timestep"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.FloatTensor</code>) &#x2014;
The encoder hidden states with shape <code>(batch, sequence_length, feature_dim)</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
A cross-attention mask of shape <code>(batch, sequence_length)</code> is applied to <code>encoder_hidden_states</code>. If
<code>True</code> the mask is kept, otherwise if <code>False</code> it is discarded. Mask will be converted into a bias,
which adds large negative values to the attention scores corresponding to &#x201C;discard&#x201D; tokens.`,name:"encoder_attention_mask"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.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/models/unet2d-cond#diffusers.models.unet_2d_condition.UNet2DConditionOutput">UNet2DConditionOutput</a> instead of a plain
tuple.`,name:"return_dict"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.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>AttnProcessor</code>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.encoder_hidden_states_1",description:`<strong>encoder_hidden_states_1</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
A second set of encoder hidden states with shape <code>(batch, sequence_length_2, feature_dim_2)</code>. Can be
used to condition the model on a different set of embeddings to <code>encoder_hidden_states</code>.`,name:"encoder_hidden_states_1"},{anchor:"diffusers.AudioLDM2UNet2DConditionModel.forward.encoder_attention_mask_1",description:`<strong>encoder_attention_mask_1</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
A cross-attention mask of shape <code>(batch, sequence_length_2)</code> is applied to <code>encoder_hidden_states_1</code>.
If <code>True</code> the mask is kept, otherwise if <code>False</code> it is discarded. Mask will be converted into a bias,
which adds large negative values to the attention scores corresponding to &#x201C;discard&#x201D; tokens.`,name:"encoder_attention_mask_1"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/audioldm2/modeling_audioldm2.py#L662",returnDescription:`
<p>If <code>return_dict</code> is True, an <a
  href="/docs/diffusers/v0.21.0/en/api/models/unet2d-cond#diffusers.models.unet_2d_condition.UNet2DConditionOutput"
>UNet2DConditionOutput</a> is returned, otherwise
a <code>tuple</code> is returned where the first element is the sample tensor.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.21.0/en/api/models/unet2d-cond#diffusers.models.unet_2d_condition.UNet2DConditionOutput"
>UNet2DConditionOutput</a> or <code>tuple</code></p>
`}}),_t=new X({}),vt=new q({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(){f=n("meta"),L=l(),g=n("h1"),h=n("a"),x=n("span"),_(u.$$.fragment),T=l(),R=n("span"),V=i("AudioLDM 2"),j=l(),B=n("p"),Mt=i("AudioLDM 2 was proposed in "),Ne=n("a"),Xn=i("AudioLDM 2: Learning Holistic Audio Generation with Self-supervised Pretraining"),Rn=i(`
by Haohe Liu et al. AudioLDM 2 takes a text prompt as input and predicts the corresponding audio. It can generate
text-conditional sound effects, human speech and music.`),Ro=l(),D=n("p"),Vn=i("Inspired by "),Pe=n("a"),Hn=i("Stable Diffusion"),Yn=i(`, AudioLDM 2
is a text-to-audio `),Jt=n("em"),Kn=i("latent diffusion model (LDM)"),ea=i(` that learns continuous audio representations from text embeddings. Two
text encoder models are used to compute the text embeddings from a prompt input: the text-branch of `),Ce=n("a"),ta=i("CLAP"),oa=i(`
and the encoder of `),Be=n("a"),na=i("Flan-T5"),aa=i(`. These text embeddings
are then projected to a shared embedding space by an `),Ie=n("a"),sa=i("AudioLDM2ProjectionModel"),ia=i(`.
A `),Je=n("a"),ra=i("GPT2"),da=l(),qt=n("em"),la=i("language model (LM)"),ca=i(` is used to auto-regressively
predict eight new embedding vectors, conditional on the projected CLAP and Flan-T5 embeddings. The generated embedding
vectors and Flan-T5 text embeddings are used as cross-attention conditioning in the LDM. The `),qe=n("a"),pa=i("UNet"),ma=i(`
of AudioLDM 2 is unique in the sense that it takes `),St=n("strong"),ua=i("two"),fa=i(` cross-attention embeddings, as opposed to one cross-attention
conditioning, as in most other LDMs.`),Vo=l(),wt=n("p"),ha=i("The abstract of the paper is the following:"),Ho=l(),yt=n("p"),Gt=n("em"),ga=i("Although audio generation shares commonalities across different types of audio, such as speech, music, and sound effects, designing models for each type requires careful consideration of specific objectives and biases that can significantly differ from those of other types. To bring us closer to a unified perspective of audio generation, this paper proposes a framework that utilizes the same learning method for speech, music, and sound effect generation. Our framework introduces a general representation of audio, called language of audio (LOA). Any audio can be translated into LOA based on AudioMAE, a self-supervised pre-trained representation learning model. In the generation process, we translate any modalities into LOA by using a GPT-2 model, and we perform self-supervised audio generation learning with a latent diffusion model conditioned on LOA. The proposed framework naturally brings advantages such as in-context learning abilities and reusable self-supervised pretrained AudioMAE and latent diffusion models. Experiments on the major benchmarks of text-to-audio, text-to-music, and text-to-speech demonstrate new state-of-the-art or competitive performance to previous approaches."),Yo=l(),S=n("p"),_a=i("This pipeline was contributed by "),Se=n("a"),va=i("sanchit-gandhi"),ba=i(`. The original codebase can be
found at `),Ge=n("a"),Ma=i("haoheliu/audioldm2"),wa=i("."),Ko=l(),H=n("h2"),pe=n("a"),Ft=n("span"),_(Fe.$$.fragment),ya=l(),Zt=n("span"),Da=i("Tips"),en=l(),Y=n("h3"),me=n("a"),Ot=n("span"),_(Ze.$$.fragment),Ta=l(),Wt=n("span"),Aa=i("Choosing a checkpoint"),tn=l(),Dt=n("p"),ka=i(`AudioLDM2 comes in three variants. Two of these checkpoints are applicable to the general task of text-to-audio
generation. The third checkpoint is trained exclusively on text-to-music generation.`),on=l(),Tt=n("p"),xa=i(`All checkpoints share the same model size for the text encoders and VAE. They differ in the size and depth of the UNet.
See table below for details on the three checkpoints:`),nn=l(),ue=n("table"),zt=n("thead"),$=n("tr"),Qt=n("th"),La=i("Checkpoint"),Ea=l(),Xt=n("th"),ja=i("Task"),$a=l(),Rt=n("th"),Ua=i("UNet Model Size"),Na=l(),Vt=n("th"),Pa=i("Total Model Size"),Ca=l(),Ht=n("th"),Ba=i("Training Data / h"),Ia=l(),K=n("tbody"),U=n("tr"),Yt=n("td"),Oe=n("a"),Ja=i("audioldm2"),qa=l(),Kt=n("td"),Sa=i("Text-to-audio"),Ga=l(),eo=n("td"),Fa=i("350M"),Za=l(),to=n("td"),Oa=i("1.1B"),Wa=l(),oo=n("td"),za=i("1150k"),Qa=l(),N=n("tr"),no=n("td"),We=n("a"),Xa=i("audioldm2-large"),Ra=l(),ao=n("td"),Va=i("Text-to-audio"),Ha=l(),so=n("td"),Ya=i("750M"),Ka=l(),io=n("td"),es=i("1.5B"),ts=l(),ro=n("td"),os=i("1150k"),ns=l(),P=n("tr"),lo=n("td"),ze=n("a"),as=i("audioldm2-music"),ss=l(),co=n("td"),is=i("Text-to-music"),rs=l(),po=n("td"),ds=i("350M"),ls=l(),mo=n("td"),cs=i("1.1B"),ps=l(),uo=n("td"),ms=i("665k"),an=l(),ee=n("h3"),fe=n("a"),fo=n("span"),_(Qe.$$.fragment),us=l(),ho=n("span"),fs=i("Constructing a prompt"),sn=l(),G=n("ul"),go=n("li"),hs=i("Descriptive prompt inputs work best: use adjectives to describe the sound (e.g. \u201Chigh quality\u201D or \u201Cclear\u201D) and make the prompt context specific (e.g. \u201Cwater stream in a forest\u201D instead of \u201Cstream\u201D)."),gs=l(),_o=n("li"),_s=i("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."),vs=l(),Xe=n("li"),bs=i("Using a "),vo=n("strong"),Ms=i("negative prompt"),ws=i(" can significantly improve the quality of the generated waveform, by guiding the generation away from terms that correspond to poor quality audio. Try using a negative prompt of \u201CLow quality.\u201D"),rn=l(),te=n("h3"),he=n("a"),bo=n("span"),_(Re.$$.fragment),ys=l(),Mo=n("span"),Ds=i("Controlling inference"),dn=l(),ge=n("ul"),oe=n("li"),Ts=i("The "),wo=n("em"),As=i("quality"),ks=i(" of the predicted audio sample can be controlled by the "),yo=n("code"),xs=i("num_inference_steps"),Ls=i(" argument; higher steps give higher quality audio at the expense of slower inference."),Es=l(),ne=n("li"),js=i("The "),Do=n("em"),$s=i("length"),Us=i(" of the predicted audio sample can be controlled by varying the "),To=n("code"),Ns=i("audio_length_in_s"),Ps=i(" argument."),ln=l(),ae=n("h3"),_e=n("a"),Ao=n("span"),_(Ve.$$.fragment),Cs=l(),ko=n("span"),Bs=i("Evaluating generated waveforms:"),cn=l(),ve=n("ul"),xo=n("li"),Is=i("The quality of the generated waveforms can vary significantly based on the seed. Try generating with different seeds until you find a satisfactory generation"),Js=l(),He=n("li"),qs=i("Multiple waveforms can be generated in one go: set "),Lo=n("code"),Ss=i("num_waveforms_per_prompt"),Gs=i(" to a value greater than 1. Automatic scoring will be performed between the generated waveforms and prompt text, and the audios ranked from best to worst accordingly."),pn=l(),be=n("p"),Fs=i("The following example demonstrates how to construct good music generation using the aforementioned tips: "),Ye=n("a"),Zs=i("example"),Os=i("."),mn=l(),_(Me.$$.fragment),un=l(),se=n("h2"),we=n("a"),Eo=n("span"),_(Ke.$$.fragment),Ws=l(),jo=n("span"),zs=i("AudioLDM2Pipeline"),fn=l(),A=n("div"),_(et.$$.fragment),Qs=l(),$o=n("p"),Xs=i("Pipeline for text-to-audio generation using AudioLDM2."),Rs=l(),tt=n("p"),Vs=i("This model inherits from "),At=n("a"),Hs=i("DiffusionPipeline"),Ys=i(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Ks=l(),F=n("div"),_(ot.$$.fragment),ei=l(),Uo=n("p"),ti=i("The call function to the pipeline for generation."),oi=l(),_(ye.$$.fragment),ni=l(),De=n("div"),_(nt.$$.fragment),ai=l(),at=n("p"),si=i("Disable sliced VAE decoding. If "),No=n("code"),ii=i("enable_vae_slicing"),ri=i(` was previously enabled, this method will go back to
computing decoding in one step.`),di=l(),Te=n("div"),_(st.$$.fragment),li=l(),Po=n("p"),ci=i(`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.`),pi=l(),Z=n("div"),_(it.$$.fragment),mi=l(),Co=n("p"),ui=i("Encodes the prompt into text encoder hidden states."),fi=l(),_(Ae.$$.fragment),hi=l(),ke=n("div"),_(rt.$$.fragment),gi=l(),Bo=n("p"),_i=i("Generates a sequence of hidden-states from the language model, conditioned on the embedding inputs."),hn=l(),ie=n("h2"),xe=n("a"),Io=n("span"),_(dt.$$.fragment),vi=l(),Jo=n("span"),bi=i("AudioLDM2ProjectionModel"),gn=l(),I=n("div"),_(lt.$$.fragment),Mi=l(),ct=n("p"),wi=i(`A simple linear projection model to map two text embeddings to a shared latent space. It also inserts learned
embedding vectors at the start and end of each text embedding sequence respectively. Each variable appended with
`),qo=n("code"),yi=i("_1"),Di=i(" refers to that corresponding to the second text encoder. Otherwise, it is from the first."),Ti=l(),kt=n("div"),_(pt.$$.fragment),_n=l(),re=n("h2"),Le=n("a"),So=n("span"),_(mt.$$.fragment),Ai=l(),Go=n("span"),ki=i("AudioLDM2UNet2DConditionModel"),vn=l(),C=n("div"),_(ut.$$.fragment),xi=l(),J=n("p"),Li=i(`A conditional 2D UNet model that takes a noisy sample, conditional state, and a timestep and returns a sample
shaped output. Compared to the vanilla `),xt=n("a"),Ei=i("UNet2DConditionModel"),ji=i(`, this variant optionally includes an additional
self-attention layer in each Transformer block, as well as multiple cross-attention layers. It also allows for up
to two cross-attention embeddings, `),Fo=n("code"),$i=i("encoder_hidden_states"),Ui=i(" and "),Zo=n("code"),Ni=i("encoder_hidden_states_1"),Pi=i("."),Ci=l(),ft=n("p"),Bi=i("This model inherits from "),Lt=n("a"),Ii=i("ModelMixin"),Ji=i(`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),qi=l(),Ee=n("div"),_(ht.$$.fragment),Si=l(),gt=n("p"),Gi=i("The "),Et=n("a"),Fi=i("AudioLDM2UNet2DConditionModel"),Zi=i(" forward method."),bn=l(),de=n("h2"),je=n("a"),Oo=n("span"),_(_t.$$.fragment),Oi=l(),Wo=n("span"),Wi=i("AudioPipelineOutput"),Mn=l(),le=n("div"),_(vt.$$.fragment),zi=l(),zo=n("p"),Qi=i("Output class for audio pipelines."),this.h()},l(t){const p=Sd('[data-svelte="svelte-1phssyn"]',document.head);f=a(p,"META",{name:!0,content:!0}),p.forEach(o),L=c(t),g=a(t,"H1",{class:!0});var bt=s(g);h=a(bt,"A",{id:!0,class:!0,href:!0});var Qo=s(h);x=a(Qo,"SPAN",{});var Xo=s(x);v(u.$$.fragment,Xo),Xo.forEach(o),Qo.forEach(o),T=c(bt),R=a(bt,"SPAN",{});var Xi=s(R);V=r(Xi,"AudioLDM 2"),Xi.forEach(o),bt.forEach(o),j=c(t),B=a(t,"P",{});var yn=s(B);Mt=r(yn,"AudioLDM 2 was proposed in "),Ne=a(yn,"A",{href:!0,rel:!0});var Ri=s(Ne);Xn=r(Ri,"AudioLDM 2: Learning Holistic Audio Generation with Self-supervised Pretraining"),Ri.forEach(o),Rn=r(yn,`
by Haohe Liu et al. AudioLDM 2 takes a text prompt as input and predicts the corresponding audio. It can generate
text-conditional sound effects, human speech and music.`),yn.forEach(o),Ro=c(t),D=a(t,"P",{});var k=s(D);Vn=r(k,"Inspired by "),Pe=a(k,"A",{href:!0,rel:!0});var Vi=s(Pe);Hn=r(Vi,"Stable Diffusion"),Vi.forEach(o),Yn=r(k,`, AudioLDM 2
is a text-to-audio `),Jt=a(k,"EM",{});var Hi=s(Jt);Kn=r(Hi,"latent diffusion model (LDM)"),Hi.forEach(o),ea=r(k,` that learns continuous audio representations from text embeddings. Two
text encoder models are used to compute the text embeddings from a prompt input: the text-branch of `),Ce=a(k,"A",{href:!0,rel:!0});var Yi=s(Ce);ta=r(Yi,"CLAP"),Yi.forEach(o),oa=r(k,`
and the encoder of `),Be=a(k,"A",{href:!0,rel:!0});var Ki=s(Be);na=r(Ki,"Flan-T5"),Ki.forEach(o),aa=r(k,`. These text embeddings
are then projected to a shared embedding space by an `),Ie=a(k,"A",{href:!0,rel:!0});var er=s(Ie);sa=r(er,"AudioLDM2ProjectionModel"),er.forEach(o),ia=r(k,`.
A `),Je=a(k,"A",{href:!0,rel:!0});var tr=s(Je);ra=r(tr,"GPT2"),tr.forEach(o),da=c(k),qt=a(k,"EM",{});var or=s(qt);la=r(or,"language model (LM)"),or.forEach(o),ca=r(k,` is used to auto-regressively
predict eight new embedding vectors, conditional on the projected CLAP and Flan-T5 embeddings. The generated embedding
vectors and Flan-T5 text embeddings are used as cross-attention conditioning in the LDM. The `),qe=a(k,"A",{href:!0,rel:!0});var nr=s(qe);pa=r(nr,"UNet"),nr.forEach(o),ma=r(k,`
of AudioLDM 2 is unique in the sense that it takes `),St=a(k,"STRONG",{});var ar=s(St);ua=r(ar,"two"),ar.forEach(o),fa=r(k,` cross-attention embeddings, as opposed to one cross-attention
conditioning, as in most other LDMs.`),k.forEach(o),Vo=c(t),wt=a(t,"P",{});var sr=s(wt);ha=r(sr,"The abstract of the paper is the following:"),sr.forEach(o),Ho=c(t),yt=a(t,"P",{});var ir=s(yt);Gt=a(ir,"EM",{});var rr=s(Gt);ga=r(rr,"Although audio generation shares commonalities across different types of audio, such as speech, music, and sound effects, designing models for each type requires careful consideration of specific objectives and biases that can significantly differ from those of other types. To bring us closer to a unified perspective of audio generation, this paper proposes a framework that utilizes the same learning method for speech, music, and sound effect generation. Our framework introduces a general representation of audio, called language of audio (LOA). Any audio can be translated into LOA based on AudioMAE, a self-supervised pre-trained representation learning model. In the generation process, we translate any modalities into LOA by using a GPT-2 model, and we perform self-supervised audio generation learning with a latent diffusion model conditioned on LOA. The proposed framework naturally brings advantages such as in-context learning abilities and reusable self-supervised pretrained AudioMAE and latent diffusion models. Experiments on the major benchmarks of text-to-audio, text-to-music, and text-to-speech demonstrate new state-of-the-art or competitive performance to previous approaches."),rr.forEach(o),ir.forEach(o),Yo=c(t),S=a(t,"P",{});var jt=s(S);_a=r(jt,"This pipeline was contributed by "),Se=a(jt,"A",{href:!0,rel:!0});var dr=s(Se);va=r(dr,"sanchit-gandhi"),dr.forEach(o),ba=r(jt,`. The original codebase can be
found at `),Ge=a(jt,"A",{href:!0,rel:!0});var lr=s(Ge);Ma=r(lr,"haoheliu/audioldm2"),lr.forEach(o),wa=r(jt,"."),jt.forEach(o),Ko=c(t),H=a(t,"H2",{class:!0});var Dn=s(H);pe=a(Dn,"A",{id:!0,class:!0,href:!0});var cr=s(pe);Ft=a(cr,"SPAN",{});var pr=s(Ft);v(Fe.$$.fragment,pr),pr.forEach(o),cr.forEach(o),ya=c(Dn),Zt=a(Dn,"SPAN",{});var mr=s(Zt);Da=r(mr,"Tips"),mr.forEach(o),Dn.forEach(o),en=c(t),Y=a(t,"H3",{class:!0});var Tn=s(Y);me=a(Tn,"A",{id:!0,class:!0,href:!0});var ur=s(me);Ot=a(ur,"SPAN",{});var fr=s(Ot);v(Ze.$$.fragment,fr),fr.forEach(o),ur.forEach(o),Ta=c(Tn),Wt=a(Tn,"SPAN",{});var hr=s(Wt);Aa=r(hr,"Choosing a checkpoint"),hr.forEach(o),Tn.forEach(o),tn=c(t),Dt=a(t,"P",{});var gr=s(Dt);ka=r(gr,`AudioLDM2 comes in three variants. Two of these checkpoints are applicable to the general task of text-to-audio
generation. The third checkpoint is trained exclusively on text-to-music generation.`),gr.forEach(o),on=c(t),Tt=a(t,"P",{});var _r=s(Tt);xa=r(_r,`All checkpoints share the same model size for the text encoders and VAE. They differ in the size and depth of the UNet.
See table below for details on the three checkpoints:`),_r.forEach(o),nn=c(t),ue=a(t,"TABLE",{});var An=s(ue);zt=a(An,"THEAD",{});var vr=s(zt);$=a(vr,"TR",{});var O=s($);Qt=a(O,"TH",{});var br=s(Qt);La=r(br,"Checkpoint"),br.forEach(o),Ea=c(O),Xt=a(O,"TH",{});var Mr=s(Xt);ja=r(Mr,"Task"),Mr.forEach(o),$a=c(O),Rt=a(O,"TH",{});var wr=s(Rt);Ua=r(wr,"UNet Model Size"),wr.forEach(o),Na=c(O),Vt=a(O,"TH",{});var yr=s(Vt);Pa=r(yr,"Total Model Size"),yr.forEach(o),Ca=c(O),Ht=a(O,"TH",{});var Dr=s(Ht);Ba=r(Dr,"Training Data / h"),Dr.forEach(o),O.forEach(o),vr.forEach(o),Ia=c(An),K=a(An,"TBODY",{});var $t=s(K);U=a($t,"TR",{});var W=s(U);Yt=a(W,"TD",{});var Tr=s(Yt);Oe=a(Tr,"A",{href:!0,rel:!0});var Ar=s(Oe);Ja=r(Ar,"audioldm2"),Ar.forEach(o),Tr.forEach(o),qa=c(W),Kt=a(W,"TD",{});var kr=s(Kt);Sa=r(kr,"Text-to-audio"),kr.forEach(o),Ga=c(W),eo=a(W,"TD",{});var xr=s(eo);Fa=r(xr,"350M"),xr.forEach(o),Za=c(W),to=a(W,"TD",{});var Lr=s(to);Oa=r(Lr,"1.1B"),Lr.forEach(o),Wa=c(W),oo=a(W,"TD",{});var Er=s(oo);za=r(Er,"1150k"),Er.forEach(o),W.forEach(o),Qa=c($t),N=a($t,"TR",{});var z=s(N);no=a(z,"TD",{});var jr=s(no);We=a(jr,"A",{href:!0,rel:!0});var $r=s(We);Xa=r($r,"audioldm2-large"),$r.forEach(o),jr.forEach(o),Ra=c(z),ao=a(z,"TD",{});var Ur=s(ao);Va=r(Ur,"Text-to-audio"),Ur.forEach(o),Ha=c(z),so=a(z,"TD",{});var Nr=s(so);Ya=r(Nr,"750M"),Nr.forEach(o),Ka=c(z),io=a(z,"TD",{});var Pr=s(io);es=r(Pr,"1.5B"),Pr.forEach(o),ts=c(z),ro=a(z,"TD",{});var Cr=s(ro);os=r(Cr,"1150k"),Cr.forEach(o),z.forEach(o),ns=c($t),P=a($t,"TR",{});var Q=s(P);lo=a(Q,"TD",{});var Br=s(lo);ze=a(Br,"A",{href:!0,rel:!0});var Ir=s(ze);as=r(Ir,"audioldm2-music"),Ir.forEach(o),Br.forEach(o),ss=c(Q),co=a(Q,"TD",{});var Jr=s(co);is=r(Jr,"Text-to-music"),Jr.forEach(o),rs=c(Q),po=a(Q,"TD",{});var qr=s(po);ds=r(qr,"350M"),qr.forEach(o),ls=c(Q),mo=a(Q,"TD",{});var Sr=s(mo);cs=r(Sr,"1.1B"),Sr.forEach(o),ps=c(Q),uo=a(Q,"TD",{});var Gr=s(uo);ms=r(Gr,"665k"),Gr.forEach(o),Q.forEach(o),$t.forEach(o),An.forEach(o),an=c(t),ee=a(t,"H3",{class:!0});var kn=s(ee);fe=a(kn,"A",{id:!0,class:!0,href:!0});var Fr=s(fe);fo=a(Fr,"SPAN",{});var Zr=s(fo);v(Qe.$$.fragment,Zr),Zr.forEach(o),Fr.forEach(o),us=c(kn),ho=a(kn,"SPAN",{});var Or=s(ho);fs=r(Or,"Constructing a prompt"),Or.forEach(o),kn.forEach(o),sn=c(t),G=a(t,"UL",{});var Ut=s(G);go=a(Ut,"LI",{});var Wr=s(go);hs=r(Wr,"Descriptive prompt inputs work best: use adjectives to describe the sound (e.g. \u201Chigh quality\u201D or \u201Cclear\u201D) and make the prompt context specific (e.g. \u201Cwater stream in a forest\u201D instead of \u201Cstream\u201D)."),Wr.forEach(o),gs=c(Ut),_o=a(Ut,"LI",{});var zr=s(_o);_s=r(zr,"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."),zr.forEach(o),vs=c(Ut),Xe=a(Ut,"LI",{});var xn=s(Xe);bs=r(xn,"Using a "),vo=a(xn,"STRONG",{});var Qr=s(vo);Ms=r(Qr,"negative prompt"),Qr.forEach(o),ws=r(xn," can significantly improve the quality of the generated waveform, by guiding the generation away from terms that correspond to poor quality audio. Try using a negative prompt of \u201CLow quality.\u201D"),xn.forEach(o),Ut.forEach(o),rn=c(t),te=a(t,"H3",{class:!0});var Ln=s(te);he=a(Ln,"A",{id:!0,class:!0,href:!0});var Xr=s(he);bo=a(Xr,"SPAN",{});var Rr=s(bo);v(Re.$$.fragment,Rr),Rr.forEach(o),Xr.forEach(o),ys=c(Ln),Mo=a(Ln,"SPAN",{});var Vr=s(Mo);Ds=r(Vr,"Controlling inference"),Vr.forEach(o),Ln.forEach(o),dn=c(t),ge=a(t,"UL",{});var En=s(ge);oe=a(En,"LI",{});var Nt=s(oe);Ts=r(Nt,"The "),wo=a(Nt,"EM",{});var Hr=s(wo);As=r(Hr,"quality"),Hr.forEach(o),ks=r(Nt," of the predicted audio sample can be controlled by the "),yo=a(Nt,"CODE",{});var Yr=s(yo);xs=r(Yr,"num_inference_steps"),Yr.forEach(o),Ls=r(Nt," argument; higher steps give higher quality audio at the expense of slower inference."),Nt.forEach(o),Es=c(En),ne=a(En,"LI",{});var Pt=s(ne);js=r(Pt,"The "),Do=a(Pt,"EM",{});var Kr=s(Do);$s=r(Kr,"length"),Kr.forEach(o),Us=r(Pt," of the predicted audio sample can be controlled by varying the "),To=a(Pt,"CODE",{});var ed=s(To);Ns=r(ed,"audio_length_in_s"),ed.forEach(o),Ps=r(Pt," argument."),Pt.forEach(o),En.forEach(o),ln=c(t),ae=a(t,"H3",{class:!0});var jn=s(ae);_e=a(jn,"A",{id:!0,class:!0,href:!0});var td=s(_e);Ao=a(td,"SPAN",{});var od=s(Ao);v(Ve.$$.fragment,od),od.forEach(o),td.forEach(o),Cs=c(jn),ko=a(jn,"SPAN",{});var nd=s(ko);Bs=r(nd,"Evaluating generated waveforms:"),nd.forEach(o),jn.forEach(o),cn=c(t),ve=a(t,"UL",{});var $n=s(ve);xo=a($n,"LI",{});var ad=s(xo);Is=r(ad,"The quality of the generated waveforms can vary significantly based on the seed. Try generating with different seeds until you find a satisfactory generation"),ad.forEach(o),Js=c($n),He=a($n,"LI",{});var Un=s(He);qs=r(Un,"Multiple waveforms can be generated in one go: set "),Lo=a(Un,"CODE",{});var sd=s(Lo);Ss=r(sd,"num_waveforms_per_prompt"),sd.forEach(o),Gs=r(Un," to a value greater than 1. Automatic scoring will be performed between the generated waveforms and prompt text, and the audios ranked from best to worst accordingly."),Un.forEach(o),$n.forEach(o),pn=c(t),be=a(t,"P",{});var Nn=s(be);Fs=r(Nn,"The following example demonstrates how to construct good music generation using the aforementioned tips: "),Ye=a(Nn,"A",{href:!0,rel:!0});var id=s(Ye);Zs=r(id,"example"),id.forEach(o),Os=r(Nn,"."),Nn.forEach(o),mn=c(t),v(Me.$$.fragment,t),un=c(t),se=a(t,"H2",{class:!0});var Pn=s(se);we=a(Pn,"A",{id:!0,class:!0,href:!0});var rd=s(we);Eo=a(rd,"SPAN",{});var dd=s(Eo);v(Ke.$$.fragment,dd),dd.forEach(o),rd.forEach(o),Ws=c(Pn),jo=a(Pn,"SPAN",{});var ld=s(jo);zs=r(ld,"AudioLDM2Pipeline"),ld.forEach(o),Pn.forEach(o),fn=c(t),A=a(t,"DIV",{class:!0});var E=s(A);v(et.$$.fragment,E),Qs=c(E),$o=a(E,"P",{});var cd=s($o);Xs=r(cd,"Pipeline for text-to-audio generation using AudioLDM2."),cd.forEach(o),Rs=c(E),tt=a(E,"P",{});var Cn=s(tt);Vs=r(Cn,"This model inherits from "),At=a(Cn,"A",{href:!0});var pd=s(At);Hs=r(pd,"DiffusionPipeline"),pd.forEach(o),Ys=r(Cn,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Cn.forEach(o),Ks=c(E),F=a(E,"DIV",{class:!0});var Ct=s(F);v(ot.$$.fragment,Ct),ei=c(Ct),Uo=a(Ct,"P",{});var md=s(Uo);ti=r(md,"The call function to the pipeline for generation."),md.forEach(o),oi=c(Ct),v(ye.$$.fragment,Ct),Ct.forEach(o),ni=c(E),De=a(E,"DIV",{class:!0});var Bn=s(De);v(nt.$$.fragment,Bn),ai=c(Bn),at=a(Bn,"P",{});var In=s(at);si=r(In,"Disable sliced VAE decoding. If "),No=a(In,"CODE",{});var ud=s(No);ii=r(ud,"enable_vae_slicing"),ud.forEach(o),ri=r(In,` was previously enabled, this method will go back to
computing decoding in one step.`),In.forEach(o),Bn.forEach(o),di=c(E),Te=a(E,"DIV",{class:!0});var Jn=s(Te);v(st.$$.fragment,Jn),li=c(Jn),Po=a(Jn,"P",{});var fd=s(Po);ci=r(fd,`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.`),fd.forEach(o),Jn.forEach(o),pi=c(E),Z=a(E,"DIV",{class:!0});var Bt=s(Z);v(it.$$.fragment,Bt),mi=c(Bt),Co=a(Bt,"P",{});var hd=s(Co);ui=r(hd,"Encodes the prompt into text encoder hidden states."),hd.forEach(o),fi=c(Bt),v(Ae.$$.fragment,Bt),Bt.forEach(o),hi=c(E),ke=a(E,"DIV",{class:!0});var qn=s(ke);v(rt.$$.fragment,qn),gi=c(qn),Bo=a(qn,"P",{});var gd=s(Bo);_i=r(gd,"Generates a sequence of hidden-states from the language model, conditioned on the embedding inputs."),gd.forEach(o),qn.forEach(o),E.forEach(o),hn=c(t),ie=a(t,"H2",{class:!0});var Sn=s(ie);xe=a(Sn,"A",{id:!0,class:!0,href:!0});var _d=s(xe);Io=a(_d,"SPAN",{});var vd=s(Io);v(dt.$$.fragment,vd),vd.forEach(o),_d.forEach(o),vi=c(Sn),Jo=a(Sn,"SPAN",{});var bd=s(Jo);bi=r(bd,"AudioLDM2ProjectionModel"),bd.forEach(o),Sn.forEach(o),gn=c(t),I=a(t,"DIV",{class:!0});var It=s(I);v(lt.$$.fragment,It),Mi=c(It),ct=a(It,"P",{});var Gn=s(ct);wi=r(Gn,`A simple linear projection model to map two text embeddings to a shared latent space. It also inserts learned
embedding vectors at the start and end of each text embedding sequence respectively. Each variable appended with
`),qo=a(Gn,"CODE",{});var Md=s(qo);yi=r(Md,"_1"),Md.forEach(o),Di=r(Gn," refers to that corresponding to the second text encoder. Otherwise, it is from the first."),Gn.forEach(o),Ti=c(It),kt=a(It,"DIV",{class:!0});var wd=s(kt);v(pt.$$.fragment,wd),wd.forEach(o),It.forEach(o),_n=c(t),re=a(t,"H2",{class:!0});var Fn=s(re);Le=a(Fn,"A",{id:!0,class:!0,href:!0});var yd=s(Le);So=a(yd,"SPAN",{});var Dd=s(So);v(mt.$$.fragment,Dd),Dd.forEach(o),yd.forEach(o),Ai=c(Fn),Go=a(Fn,"SPAN",{});var Td=s(Go);ki=r(Td,"AudioLDM2UNet2DConditionModel"),Td.forEach(o),Fn.forEach(o),vn=c(t),C=a(t,"DIV",{class:!0});var $e=s(C);v(ut.$$.fragment,$e),xi=c($e),J=a($e,"P",{});var Ue=s(J);Li=r(Ue,`A conditional 2D UNet model that takes a noisy sample, conditional state, and a timestep and returns a sample
shaped output. Compared to the vanilla `),xt=a(Ue,"A",{href:!0});var Ad=s(xt);Ei=r(Ad,"UNet2DConditionModel"),Ad.forEach(o),ji=r(Ue,`, this variant optionally includes an additional
self-attention layer in each Transformer block, as well as multiple cross-attention layers. It also allows for up
to two cross-attention embeddings, `),Fo=a(Ue,"CODE",{});var kd=s(Fo);$i=r(kd,"encoder_hidden_states"),kd.forEach(o),Ui=r(Ue," and "),Zo=a(Ue,"CODE",{});var xd=s(Zo);Ni=r(xd,"encoder_hidden_states_1"),xd.forEach(o),Pi=r(Ue,"."),Ue.forEach(o),Ci=c($e),ft=a($e,"P",{});var Zn=s(ft);Bi=r(Zn,"This model inherits from "),Lt=a(Zn,"A",{href:!0});var Ld=s(Lt);Ii=r(Ld,"ModelMixin"),Ld.forEach(o),Ji=r(Zn,`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),Zn.forEach(o),qi=c($e),Ee=a($e,"DIV",{class:!0});var On=s(Ee);v(ht.$$.fragment,On),Si=c(On),gt=a(On,"P",{});var Wn=s(gt);Gi=r(Wn,"The "),Et=a(Wn,"A",{href:!0});var Ed=s(Et);Fi=r(Ed,"AudioLDM2UNet2DConditionModel"),Ed.forEach(o),Zi=r(Wn," forward method."),Wn.forEach(o),On.forEach(o),$e.forEach(o),bn=c(t),de=a(t,"H2",{class:!0});var zn=s(de);je=a(zn,"A",{id:!0,class:!0,href:!0});var jd=s(je);Oo=a(jd,"SPAN",{});var $d=s(Oo);v(_t.$$.fragment,$d),$d.forEach(o),jd.forEach(o),Oi=c(zn),Wo=a(zn,"SPAN",{});var Ud=s(Wo);Wi=r(Ud,"AudioPipelineOutput"),Ud.forEach(o),zn.forEach(o),Mn=c(t),le=a(t,"DIV",{class:!0});var Qn=s(le);v(vt.$$.fragment,Qn),zi=c(Qn),zo=a(Qn,"P",{});var Nd=s(zo);Qi=r(Nd,"Output class for audio pipelines."),Nd.forEach(o),Qn.forEach(o),this.h()},h(){d(f,"name","hf:doc:metadata"),d(f,"content",JSON.stringify(Qd)),d(h,"id","audioldm-2"),d(h,"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(h,"href","#audioldm-2"),d(g,"class","relative group"),d(Ne,"href","https://arxiv.org/abs/2308.05734"),d(Ne,"rel","nofollow"),d(Pe,"href","https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/overview"),d(Pe,"rel","nofollow"),d(Ce,"href","https://huggingface.co/docs/transformers/main/en/model_doc/clap"),d(Ce,"rel","nofollow"),d(Be,"href","https://huggingface.co/docs/transformers/main/en/model_doc/flan-t5"),d(Be,"rel","nofollow"),d(Ie,"href","https://huggingface.co/docs/diffusers/main/api/pipelines/audioldm2#diffusers.AudioLDM2ProjectionModel"),d(Ie,"rel","nofollow"),d(Je,"href","https://huggingface.co/docs/transformers/main/en/model_doc/gpt2"),d(Je,"rel","nofollow"),d(qe,"href","https://huggingface.co/docs/diffusers/main/en/api/pipelines/audioldm2#diffusers.AudioLDM2UNet2DConditionModel"),d(qe,"rel","nofollow"),d(Se,"href","https://huggingface.co/sanchit-gandhi"),d(Se,"rel","nofollow"),d(Ge,"href","https://github.com/haoheliu/audioldm2"),d(Ge,"rel","nofollow"),d(pe,"id","tips"),d(pe,"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(pe,"href","#tips"),d(H,"class","relative group"),d(me,"id","choosing-a-checkpoint"),d(me,"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(me,"href","#choosing-a-checkpoint"),d(Y,"class","relative group"),d(Oe,"href","https://huggingface.co/cvssp/audioldm2"),d(Oe,"rel","nofollow"),d(We,"href","https://huggingface.co/cvssp/audioldm2-large"),d(We,"rel","nofollow"),d(ze,"href","https://huggingface.co/cvssp/audioldm2-music"),d(ze,"rel","nofollow"),d(fe,"id","constructing-a-prompt"),d(fe,"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(fe,"href","#constructing-a-prompt"),d(ee,"class","relative group"),d(he,"id","controlling-inference"),d(he,"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(he,"href","#controlling-inference"),d(te,"class","relative group"),d(_e,"id","evaluating-generated-waveforms"),d(_e,"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(_e,"href","#evaluating-generated-waveforms"),d(ae,"class","relative group"),d(Ye,"href","https://huggingface.co/docs/diffusers/main/en/api/pipelines/audioldm2#diffusers.AudioLDM2Pipeline.__call__.example"),d(Ye,"rel","nofollow"),d(we,"id","diffusers.AudioLDM2Pipeline"),d(we,"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(we,"href","#diffusers.AudioLDM2Pipeline"),d(se,"class","relative group"),d(At,"href","/docs/diffusers/v0.21.0/en/api/pipelines/overview#diffusers.DiffusionPipeline"),d(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(xe,"id","diffusers.AudioLDM2ProjectionModel"),d(xe,"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(xe,"href","#diffusers.AudioLDM2ProjectionModel"),d(ie,"class","relative group"),d(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Le,"id","diffusers.AudioLDM2UNet2DConditionModel"),d(Le,"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(Le,"href","#diffusers.AudioLDM2UNet2DConditionModel"),d(re,"class","relative group"),d(xt,"href","/docs/diffusers/v0.21.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel"),d(Lt,"href","/docs/diffusers/v0.21.0/en/api/models/overview#diffusers.ModelMixin"),d(Et,"href","/docs/diffusers/v0.21.0/en/api/pipelines/audioldm2#diffusers.AudioLDM2UNet2DConditionModel"),d(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(je,"id","diffusers.AudioPipelineOutput"),d(je,"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(je,"href","#diffusers.AudioPipelineOutput"),d(de,"class","relative group"),d(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,f),m(t,L,p),m(t,g,p),e(g,h),e(h,x),b(u,x,null),e(g,T),e(g,R),e(R,V),m(t,j,p),m(t,B,p),e(B,Mt),e(B,Ne),e(Ne,Xn),e(B,Rn),m(t,Ro,p),m(t,D,p),e(D,Vn),e(D,Pe),e(Pe,Hn),e(D,Yn),e(D,Jt),e(Jt,Kn),e(D,ea),e(D,Ce),e(Ce,ta),e(D,oa),e(D,Be),e(Be,na),e(D,aa),e(D,Ie),e(Ie,sa),e(D,ia),e(D,Je),e(Je,ra),e(D,da),e(D,qt),e(qt,la),e(D,ca),e(D,qe),e(qe,pa),e(D,ma),e(D,St),e(St,ua),e(D,fa),m(t,Vo,p),m(t,wt,p),e(wt,ha),m(t,Ho,p),m(t,yt,p),e(yt,Gt),e(Gt,ga),m(t,Yo,p),m(t,S,p),e(S,_a),e(S,Se),e(Se,va),e(S,ba),e(S,Ge),e(Ge,Ma),e(S,wa),m(t,Ko,p),m(t,H,p),e(H,pe),e(pe,Ft),b(Fe,Ft,null),e(H,ya),e(H,Zt),e(Zt,Da),m(t,en,p),m(t,Y,p),e(Y,me),e(me,Ot),b(Ze,Ot,null),e(Y,Ta),e(Y,Wt),e(Wt,Aa),m(t,tn,p),m(t,Dt,p),e(Dt,ka),m(t,on,p),m(t,Tt,p),e(Tt,xa),m(t,nn,p),m(t,ue,p),e(ue,zt),e(zt,$),e($,Qt),e(Qt,La),e($,Ea),e($,Xt),e(Xt,ja),e($,$a),e($,Rt),e(Rt,Ua),e($,Na),e($,Vt),e(Vt,Pa),e($,Ca),e($,Ht),e(Ht,Ba),e(ue,Ia),e(ue,K),e(K,U),e(U,Yt),e(Yt,Oe),e(Oe,Ja),e(U,qa),e(U,Kt),e(Kt,Sa),e(U,Ga),e(U,eo),e(eo,Fa),e(U,Za),e(U,to),e(to,Oa),e(U,Wa),e(U,oo),e(oo,za),e(K,Qa),e(K,N),e(N,no),e(no,We),e(We,Xa),e(N,Ra),e(N,ao),e(ao,Va),e(N,Ha),e(N,so),e(so,Ya),e(N,Ka),e(N,io),e(io,es),e(N,ts),e(N,ro),e(ro,os),e(K,ns),e(K,P),e(P,lo),e(lo,ze),e(ze,as),e(P,ss),e(P,co),e(co,is),e(P,rs),e(P,po),e(po,ds),e(P,ls),e(P,mo),e(mo,cs),e(P,ps),e(P,uo),e(uo,ms),m(t,an,p),m(t,ee,p),e(ee,fe),e(fe,fo),b(Qe,fo,null),e(ee,us),e(ee,ho),e(ho,fs),m(t,sn,p),m(t,G,p),e(G,go),e(go,hs),e(G,gs),e(G,_o),e(_o,_s),e(G,vs),e(G,Xe),e(Xe,bs),e(Xe,vo),e(vo,Ms),e(Xe,ws),m(t,rn,p),m(t,te,p),e(te,he),e(he,bo),b(Re,bo,null),e(te,ys),e(te,Mo),e(Mo,Ds),m(t,dn,p),m(t,ge,p),e(ge,oe),e(oe,Ts),e(oe,wo),e(wo,As),e(oe,ks),e(oe,yo),e(yo,xs),e(oe,Ls),e(ge,Es),e(ge,ne),e(ne,js),e(ne,Do),e(Do,$s),e(ne,Us),e(ne,To),e(To,Ns),e(ne,Ps),m(t,ln,p),m(t,ae,p),e(ae,_e),e(_e,Ao),b(Ve,Ao,null),e(ae,Cs),e(ae,ko),e(ko,Bs),m(t,cn,p),m(t,ve,p),e(ve,xo),e(xo,Is),e(ve,Js),e(ve,He),e(He,qs),e(He,Lo),e(Lo,Ss),e(He,Gs),m(t,pn,p),m(t,be,p),e(be,Fs),e(be,Ye),e(Ye,Zs),e(be,Os),m(t,mn,p),b(Me,t,p),m(t,un,p),m(t,se,p),e(se,we),e(we,Eo),b(Ke,Eo,null),e(se,Ws),e(se,jo),e(jo,zs),m(t,fn,p),m(t,A,p),b(et,A,null),e(A,Qs),e(A,$o),e($o,Xs),e(A,Rs),e(A,tt),e(tt,Vs),e(tt,At),e(At,Hs),e(tt,Ys),e(A,Ks),e(A,F),b(ot,F,null),e(F,ei),e(F,Uo),e(Uo,ti),e(F,oi),b(ye,F,null),e(A,ni),e(A,De),b(nt,De,null),e(De,ai),e(De,at),e(at,si),e(at,No),e(No,ii),e(at,ri),e(A,di),e(A,Te),b(st,Te,null),e(Te,li),e(Te,Po),e(Po,ci),e(A,pi),e(A,Z),b(it,Z,null),e(Z,mi),e(Z,Co),e(Co,ui),e(Z,fi),b(Ae,Z,null),e(A,hi),e(A,ke),b(rt,ke,null),e(ke,gi),e(ke,Bo),e(Bo,_i),m(t,hn,p),m(t,ie,p),e(ie,xe),e(xe,Io),b(dt,Io,null),e(ie,vi),e(ie,Jo),e(Jo,bi),m(t,gn,p),m(t,I,p),b(lt,I,null),e(I,Mi),e(I,ct),e(ct,wi),e(ct,qo),e(qo,yi),e(ct,Di),e(I,Ti),e(I,kt),b(pt,kt,null),m(t,_n,p),m(t,re,p),e(re,Le),e(Le,So),b(mt,So,null),e(re,Ai),e(re,Go),e(Go,ki),m(t,vn,p),m(t,C,p),b(ut,C,null),e(C,xi),e(C,J),e(J,Li),e(J,xt),e(xt,Ei),e(J,ji),e(J,Fo),e(Fo,$i),e(J,Ui),e(J,Zo),e(Zo,Ni),e(J,Pi),e(C,Ci),e(C,ft),e(ft,Bi),e(ft,Lt),e(Lt,Ii),e(ft,Ji),e(C,qi),e(C,Ee),b(ht,Ee,null),e(Ee,Si),e(Ee,gt),e(gt,Gi),e(gt,Et),e(Et,Fi),e(gt,Zi),m(t,bn,p),m(t,de,p),e(de,je),e(je,Oo),b(_t,Oo,null),e(de,Oi),e(de,Wo),e(Wo,Wi),m(t,Mn,p),m(t,le,p),b(vt,le,null),e(le,zi),e(le,zo),e(zo,Qi),wn=!0},p(t,[p]){const bt={};p&2&&(bt.$$scope={dirty:p,ctx:t}),Me.$set(bt);const Qo={};p&2&&(Qo.$$scope={dirty:p,ctx:t}),ye.$set(Qo);const Xo={};p&2&&(Xo.$$scope={dirty:p,ctx:t}),Ae.$set(Xo)},i(t){wn||(M(u.$$.fragment,t),M(Fe.$$.fragment,t),M(Ze.$$.fragment,t),M(Qe.$$.fragment,t),M(Re.$$.fragment,t),M(Ve.$$.fragment,t),M(Me.$$.fragment,t),M(Ke.$$.fragment,t),M(et.$$.fragment,t),M(ot.$$.fragment,t),M(ye.$$.fragment,t),M(nt.$$.fragment,t),M(st.$$.fragment,t),M(it.$$.fragment,t),M(Ae.$$.fragment,t),M(rt.$$.fragment,t),M(dt.$$.fragment,t),M(lt.$$.fragment,t),M(pt.$$.fragment,t),M(mt.$$.fragment,t),M(ut.$$.fragment,t),M(ht.$$.fragment,t),M(_t.$$.fragment,t),M(vt.$$.fragment,t),wn=!0)},o(t){w(u.$$.fragment,t),w(Fe.$$.fragment,t),w(Ze.$$.fragment,t),w(Qe.$$.fragment,t),w(Re.$$.fragment,t),w(Ve.$$.fragment,t),w(Me.$$.fragment,t),w(Ke.$$.fragment,t),w(et.$$.fragment,t),w(ot.$$.fragment,t),w(ye.$$.fragment,t),w(nt.$$.fragment,t),w(st.$$.fragment,t),w(it.$$.fragment,t),w(Ae.$$.fragment,t),w(rt.$$.fragment,t),w(dt.$$.fragment,t),w(lt.$$.fragment,t),w(pt.$$.fragment,t),w(mt.$$.fragment,t),w(ut.$$.fragment,t),w(ht.$$.fragment,t),w(_t.$$.fragment,t),w(vt.$$.fragment,t),wn=!1},d(t){o(f),t&&o(L),t&&o(g),y(u),t&&o(j),t&&o(B),t&&o(Ro),t&&o(D),t&&o(Vo),t&&o(wt),t&&o(Ho),t&&o(yt),t&&o(Yo),t&&o(S),t&&o(Ko),t&&o(H),y(Fe),t&&o(en),t&&o(Y),y(Ze),t&&o(tn),t&&o(Dt),t&&o(on),t&&o(Tt),t&&o(nn),t&&o(ue),t&&o(an),t&&o(ee),y(Qe),t&&o(sn),t&&o(G),t&&o(rn),t&&o(te),y(Re),t&&o(dn),t&&o(ge),t&&o(ln),t&&o(ae),y(Ve),t&&o(cn),t&&o(ve),t&&o(pn),t&&o(be),t&&o(mn),y(Me,t),t&&o(un),t&&o(se),y(Ke),t&&o(fn),t&&o(A),y(et),y(ot),y(ye),y(nt),y(st),y(it),y(Ae),y(rt),t&&o(hn),t&&o(ie),y(dt),t&&o(gn),t&&o(I),y(lt),y(pt),t&&o(_n),t&&o(re),y(mt),t&&o(vn),t&&o(C),y(ut),y(ht),t&&o(bn),t&&o(de),y(_t),t&&o(Mn),t&&o(le),y(vt)}}}const Qd={local:"audioldm-2",sections:[{local:"tips",sections:[{local:"choosing-a-checkpoint",title:"Choosing a checkpoint"},{local:"constructing-a-prompt",title:"Constructing a prompt"},{local:"controlling-inference",title:"Controlling inference"},{local:"evaluating-generated-waveforms",title:"Evaluating generated waveforms:"}],title:"Tips"},{local:"diffusers.AudioLDM2Pipeline",title:"AudioLDM2Pipeline"},{local:"diffusers.AudioLDM2ProjectionModel",title:"AudioLDM2ProjectionModel"},{local:"diffusers.AudioLDM2UNet2DConditionModel",title:"AudioLDM2UNet2DConditionModel"},{local:"diffusers.AudioPipelineOutput",title:"AudioPipelineOutput"}],title:"AudioLDM 2"};function Xd(ce){return Gd(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tl extends Id{constructor(f){super();Jd(this,f,Xd,zd,qd,{})}}export{tl as default,Qd as metadata};
