import{s as me,n as _e,o as pe}from"../chunks/scheduler.8c3d61f6.js";import{S as he,i as Ae,g as d,s as n,r as $,A as ge,h as a,f as t,c as i,j as I,u as y,x as G,k as V,y as r,a as l,v as D,d as x,t as F,w as M}from"../chunks/index.da70eac4.js";import{D as B}from"../chunks/Docstring.6b390b9a.js";import{H as ue,E as be}from"../chunks/EditOnGithub.1e64e623.js";function Pe(ne){let f,N,H,z,p,E,h,ie='A Transformer model for audio waveforms from <a href="https://huggingface.co/papers/2407.14358" rel="nofollow">Stable Audio Open</a>.',K,A,R,o,g,Q,S,de="The Diffusion Transformer model introduced in Stable Audio.",Y,w,ae='Reference: <a href="https://github.com/Stability-AI/stable-audio-tools" rel="nofollow">https://github.com/Stability-AI/stable-audio-tools</a>',Z,u,b,ee,k,ce='The <a href="/docs/diffusers/pr_10009/en/api/models/stable_audio_transformer#diffusers.StableAudioDiTModel">StableAudioDiTModel</a> forward method.',te,m,P,oe,C,le="Sets the attention processor to use to compute attention.",se,_,T,re,L,fe="Disables custom attention processors and sets the default attention implementation.",U,v,j,X,q;return p=new ue({props:{title:"StableAudioDiTModel",local:"stableaudioditmodel",headingTag:"h1"}}),A=new ue({props:{title:"StableAudioDiTModel",local:"diffusers.StableAudioDiTModel",headingTag:"h2"}}),g=new B({props:{name:"class diffusers.StableAudioDiTModel",anchor:"diffusers.StableAudioDiTModel",parameters:[{name:"sample_size",val:": int = 1024"},{name:"in_channels",val:": int = 64"},{name:"num_layers",val:": int = 24"},{name:"attention_head_dim",val:": int = 64"},{name:"num_attention_heads",val:": int = 24"},{name:"num_key_value_attention_heads",val:": int = 12"},{name:"out_channels",val:": int = 64"},{name:"cross_attention_dim",val:": int = 768"},{name:"time_proj_dim",val:": int = 256"},{name:"global_states_input_dim",val:": int = 1536"},{name:"cross_attention_input_dim",val:": int = 768"}],parametersDescription:[{anchor:"diffusers.StableAudioDiTModel.sample_size",description:"<strong>sample_size</strong> ( <code>int</code>, <em>optional</em>, defaults to 1024) &#x2014; The size of the input sample.",name:"sample_size"},{anchor:"diffusers.StableAudioDiTModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014; The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.StableAudioDiTModel.num_layers",description:"<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014; The number of layers of Transformer blocks to use.",name:"num_layers"},{anchor:"diffusers.StableAudioDiTModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014; The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.StableAudioDiTModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 24) &#x2014; The number of heads to use for the query states.",name:"num_attention_heads"},{anchor:"diffusers.StableAudioDiTModel.num_key_value_attention_heads",description:`<strong>num_key_value_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
The number of heads to use for the key and value states.`,name:"num_key_value_attention_heads"},{anchor:"diffusers.StableAudioDiTModel.out_channels",description:"<strong>out_channels</strong> (<code>int</code>, defaults to 64) &#x2014; Number of output channels.",name:"out_channels"},{anchor:"diffusers.StableAudioDiTModel.cross_attention_dim",description:"<strong>cross_attention_dim</strong> ( <code>int</code>, <em>optional</em>, defaults to 768) &#x2014; Dimension of the cross-attention projection.",name:"cross_attention_dim"},{anchor:"diffusers.StableAudioDiTModel.time_proj_dim",description:"<strong>time_proj_dim</strong> ( <code>int</code>, <em>optional</em>, defaults to 256) &#x2014; Dimension of the timestep inner projection.",name:"time_proj_dim"},{anchor:"diffusers.StableAudioDiTModel.global_states_input_dim",description:`<strong>global_states_input_dim</strong> ( <code>int</code>, <em>optional</em>, defaults to 1536) &#x2014;
Input dimension of the global hidden states projection.`,name:"global_states_input_dim"},{anchor:"diffusers.StableAudioDiTModel.cross_attention_input_dim",description:`<strong>cross_attention_input_dim</strong> ( <code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Input dimension of the cross-attention projection`,name:"cross_attention_input_dim"}],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/models/transformers/stable_audio_transformer.py#L190"}}),b=new B({props:{name:"forward",anchor:"diffusers.StableAudioDiTModel.forward",parameters:[{name:"hidden_states",val:": FloatTensor"},{name:"timestep",val:": LongTensor = None"},{name:"encoder_hidden_states",val:": FloatTensor = None"},{name:"global_hidden_states",val:": FloatTensor = None"},{name:"rotary_embedding",val:": FloatTensor = None"},{name:"return_dict",val:": bool = True"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"diffusers.StableAudioDiTModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, in_channels, sequence_len)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.StableAudioDiTModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.StableAudioDiTModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, encoder_sequence_len, cross_attention_input_dim)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.StableAudioDiTModel.forward.global_hidden_states",description:`<strong>global_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, global_sequence_len, global_states_input_dim)</code>) &#x2014;
Global embeddings that will be prepended to the hidden states.`,name:"global_hidden_states"},{anchor:"diffusers.StableAudioDiTModel.forward.rotary_embedding",description:`<strong>rotary_embedding</strong> (<code>torch.Tensor</code>) &#x2014;
The rotary embeddings to apply on query and key tensors during attention calculation.`,name:"rotary_embedding"},{anchor:"diffusers.StableAudioDiTModel.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 <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain
tuple.`,name:"return_dict"},{anchor:"diffusers.StableAudioDiTModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_len)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices, formed by concatenating the attention
masks
for the two text encoders together. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"diffusers.StableAudioDiTModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_len)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token cross-attention indices, formed by concatenating
the attention masks
for the two text encoders together. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>`,name:"encoder_attention_mask"}],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/models/transformers/stable_audio_transformer.py#L352",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is True, an <code>~models.transformer_2d.Transformer2DModelOutput</code> is returned, otherwise a
<code>tuple</code> where the first element is the sample tensor.</p>
`}}),P=new B({props:{name:"set_attn_processor",anchor:"diffusers.StableAudioDiTModel.set_attn_processor",parameters:[{name:"processor",val:": typing.Union[diffusers.models.attention_processor.AttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor2_0, diffusers.models.attention_processor.JointAttnProcessor2_0, diffusers.models.attention_processor.PAGJointAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGJointAttnProcessor2_0, diffusers.models.attention_processor.FusedJointAttnProcessor2_0, diffusers.models.attention_processor.AllegroAttnProcessor2_0, diffusers.models.attention_processor.AuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FusedAuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.CogVideoXAttnProcessor2_0, diffusers.models.attention_processor.FusedCogVideoXAttnProcessor2_0, diffusers.models.attention_processor.XFormersAttnAddedKVProcessor, diffusers.models.attention_processor.XFormersAttnProcessor, diffusers.models.attention_processor.XLAFlashAttnProcessor2_0, diffusers.models.attention_processor.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_0, diffusers.models.attention_processor.StableAudioAttnProcessor2_0, diffusers.models.attention_processor.HunyuanAttnProcessor2_0, diffusers.models.attention_processor.FusedHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.LuminaAttnProcessor2_0, diffusers.models.attention_processor.MochiAttnProcessor2_0, diffusers.models.attention_processor.FusedAttnProcessor2_0, diffusers.models.attention_processor.CustomDiffusionXFormersAttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor2_0, diffusers.models.attention_processor.SlicedAttnProcessor, diffusers.models.attention_processor.SlicedAttnAddedKVProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.PAGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.LoRAAttnProcessor, diffusers.models.attention_processor.LoRAAttnProcessor2_0, diffusers.models.attention_processor.LoRAXFormersAttnProcessor, diffusers.models.attention_processor.LoRAAttnAddedKVProcessor, typing.Dict[str, typing.Union[diffusers.models.attention_processor.AttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor2_0, diffusers.models.attention_processor.JointAttnProcessor2_0, diffusers.models.attention_processor.PAGJointAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGJointAttnProcessor2_0, diffusers.models.attention_processor.FusedJointAttnProcessor2_0, diffusers.models.attention_processor.AllegroAttnProcessor2_0, diffusers.models.attention_processor.AuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FusedAuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.CogVideoXAttnProcessor2_0, diffusers.models.attention_processor.FusedCogVideoXAttnProcessor2_0, diffusers.models.attention_processor.XFormersAttnAddedKVProcessor, diffusers.models.attention_processor.XFormersAttnProcessor, diffusers.models.attention_processor.XLAFlashAttnProcessor2_0, diffusers.models.attention_processor.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_0, diffusers.models.attention_processor.StableAudioAttnProcessor2_0, diffusers.models.attention_processor.HunyuanAttnProcessor2_0, diffusers.models.attention_processor.FusedHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.LuminaAttnProcessor2_0, diffusers.models.attention_processor.MochiAttnProcessor2_0, diffusers.models.attention_processor.FusedAttnProcessor2_0, diffusers.models.attention_processor.CustomDiffusionXFormersAttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor2_0, diffusers.models.attention_processor.SlicedAttnProcessor, diffusers.models.attention_processor.SlicedAttnAddedKVProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.PAGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.LoRAAttnProcessor, diffusers.models.attention_processor.LoRAAttnProcessor2_0, diffusers.models.attention_processor.LoRAXFormersAttnProcessor, diffusers.models.attention_processor.LoRAAttnAddedKVProcessor]]]"}],parametersDescription:[{anchor:"diffusers.StableAudioDiTModel.set_attn_processor.processor",description:`<strong>processor</strong> (<code>dict</code> of <code>AttentionProcessor</code> or only <code>AttentionProcessor</code>) &#x2014;
The instantiated processor class or a dictionary of processor classes that will be set as the processor
for <strong>all</strong> <code>Attention</code> layers.</p>
<p>If <code>processor</code> is a dict, the key needs to define the path to the corresponding cross attention
processor. This is strongly recommended when setting trainable attention processors.`,name:"processor"}],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/models/transformers/stable_audio_transformer.py#L307"}}),T=new B({props:{name:"set_default_attn_processor",anchor:"diffusers.StableAudioDiTModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/models/transformers/stable_audio_transformer.py#L342"}}),v=new be({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/stable_audio_transformer.md"}}),{c(){f=d("meta"),N=n(),H=d("p"),z=n(),$(p.$$.fragment),E=n(),h=d("p"),h.innerHTML=ie,K=n(),$(A.$$.fragment),R=n(),o=d("div"),$(g.$$.fragment),Q=n(),S=d("p"),S.textContent=de,Y=n(),w=d("p"),w.innerHTML=ae,Z=n(),u=d("div"),$(b.$$.fragment),ee=n(),k=d("p"),k.innerHTML=ce,te=n(),m=d("div"),$(P.$$.fragment),oe=n(),C=d("p"),C.textContent=le,se=n(),_=d("div"),$(T.$$.fragment),re=n(),L=d("p"),L.textContent=fe,U=n(),$(v.$$.fragment),j=n(),X=d("p"),this.h()},l(e){const s=ge("svelte-u9bgzb",document.head);f=a(s,"META",{name:!0,content:!0}),s.forEach(t),N=i(e),H=a(e,"P",{}),I(H).forEach(t),z=i(e),y(p.$$.fragment,e),E=i(e),h=a(e,"P",{"data-svelte-h":!0}),G(h)!=="svelte-g5z5pk"&&(h.innerHTML=ie),K=i(e),y(A.$$.fragment,e),R=i(e),o=a(e,"DIV",{class:!0});var c=I(o);y(g.$$.fragment,c),Q=i(c),S=a(c,"P",{"data-svelte-h":!0}),G(S)!=="svelte-cole5l"&&(S.textContent=de),Y=i(c),w=a(c,"P",{"data-svelte-h":!0}),G(w)!=="svelte-hb3xoq"&&(w.innerHTML=ae),Z=i(c),u=a(c,"DIV",{class:!0});var J=I(u);y(b.$$.fragment,J),ee=i(J),k=a(J,"P",{"data-svelte-h":!0}),G(k)!=="svelte-1fcef0n"&&(k.innerHTML=ce),J.forEach(t),te=i(c),m=a(c,"DIV",{class:!0});var O=I(m);y(P.$$.fragment,O),oe=i(O),C=a(O,"P",{"data-svelte-h":!0}),G(C)!=="svelte-1o77hl2"&&(C.textContent=le),O.forEach(t),se=i(c),_=a(c,"DIV",{class:!0});var W=I(_);y(T.$$.fragment,W),re=i(W),L=a(W,"P",{"data-svelte-h":!0}),G(L)!=="svelte-1lxcwhv"&&(L.textContent=fe),W.forEach(t),c.forEach(t),U=i(e),y(v.$$.fragment,e),j=i(e),X=a(e,"P",{}),I(X).forEach(t),this.h()},h(){V(f,"name","hf:doc:metadata"),V(f,"content",Te),V(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),V(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),V(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),V(o,"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,s){r(document.head,f),l(e,N,s),l(e,H,s),l(e,z,s),D(p,e,s),l(e,E,s),l(e,h,s),l(e,K,s),D(A,e,s),l(e,R,s),l(e,o,s),D(g,o,null),r(o,Q),r(o,S),r(o,Y),r(o,w),r(o,Z),r(o,u),D(b,u,null),r(u,ee),r(u,k),r(o,te),r(o,m),D(P,m,null),r(m,oe),r(m,C),r(o,se),r(o,_),D(T,_,null),r(_,re),r(_,L),l(e,U,s),D(v,e,s),l(e,j,s),l(e,X,s),q=!0},p:_e,i(e){q||(x(p.$$.fragment,e),x(A.$$.fragment,e),x(g.$$.fragment,e),x(b.$$.fragment,e),x(P.$$.fragment,e),x(T.$$.fragment,e),x(v.$$.fragment,e),q=!0)},o(e){F(p.$$.fragment,e),F(A.$$.fragment,e),F(g.$$.fragment,e),F(b.$$.fragment,e),F(P.$$.fragment,e),F(T.$$.fragment,e),F(v.$$.fragment,e),q=!1},d(e){e&&(t(N),t(H),t(z),t(E),t(h),t(K),t(R),t(o),t(U),t(j),t(X)),t(f),M(p,e),M(A,e),M(g),M(b),M(P),M(T),M(v,e)}}}const Te='{"title":"StableAudioDiTModel","local":"stableaudioditmodel","sections":[{"title":"StableAudioDiTModel","local":"diffusers.StableAudioDiTModel","sections":[],"depth":2}],"depth":1}';function ve(ne){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fe extends he{constructor(f){super(),Ae(this,f,ve,Pe,me,{})}}export{Fe as component};
