import{s as pe,n as Ae,o as he}from"../chunks/scheduler.53228c21.js";import{S as ge,i as Pe,e as d,s as n,c as p,h as be,a,d as t,b as i,f as I,g as A,j as V,k as H,l as r,m as l,n as h,t as g,o as P,p as b}from"../chunks/index.100fac89.js";import{C as Te}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as Y}from"../chunks/Docstring.db856a1e.js";import{H as _e,E as Se}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function $e(de){let f,N,X,j,T,E,S,J,$,ae='A Transformer model for audio waveforms from <a href="https://huggingface.co/papers/2407.14358" rel="nofollow">Stable Audio Open</a>.',K,v,R,s,y,Z,w,ce="The Diffusion Transformer model introduced in Stable Audio.",ee,L,le='Reference: <a href="https://github.com/Stability-AI/stable-audio-tools" rel="nofollow">https://github.com/Stability-AI/stable-audio-tools</a>',te,m,M,oe,k,fe='The <a href="/docs/diffusers/main/en/api/models/stable_audio_transformer#diffusers.StableAudioDiTModel">StableAudioDiTModel</a> forward method.',se,u,x,re,C,me="Sets the attention processor to use to compute attention.",ne,_,D,ie,G,ue="Disables custom attention processors and sets the default attention implementation.",U,F,q,z,O;return T=new Te({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),S=new _e({props:{title:"StableAudioDiTModel",local:"stableaudioditmodel",headingTag:"h1"}}),v=new _e({props:{title:"StableAudioDiTModel",local:"diffusers.StableAudioDiTModel",headingTag:"h2"}}),y=new Y({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/main/src/diffusers/models/transformers/stable_audio_transformer.py#L186"}}),M=new Y({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/main/src/diffusers/models/transformers/stable_audio_transformer.py#L345",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>
`}}),x=new Y({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.MochiAttnProcessor2_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.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.SanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGSanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySanaLinearAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleLinearAttention, diffusers.models.attention_processor.SanaMultiscaleAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleAttentionProjection, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.SD3IPAdapterJointAttnProcessor2_0, 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.MochiAttnProcessor2_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.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.SanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGSanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySanaLinearAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleLinearAttention, diffusers.models.attention_processor.SanaMultiscaleAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleAttentionProjection, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.SD3IPAdapterJointAttnProcessor2_0, 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/main/src/diffusers/models/transformers/stable_audio_transformer.py#L304"}}),D=new Y({props:{name:"set_default_attn_processor",anchor:"diffusers.StableAudioDiTModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/stable_audio_transformer.py#L339"}}),F=new Se({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/stable_audio_transformer.md"}}),{c(){f=d("meta"),N=n(),X=d("p"),j=n(),p(T.$$.fragment),E=n(),p(S.$$.fragment),J=n(),$=d("p"),$.innerHTML=ae,K=n(),p(v.$$.fragment),R=n(),s=d("div"),p(y.$$.fragment),Z=n(),w=d("p"),w.textContent=ce,ee=n(),L=d("p"),L.innerHTML=le,te=n(),m=d("div"),p(M.$$.fragment),oe=n(),k=d("p"),k.innerHTML=fe,se=n(),u=d("div"),p(x.$$.fragment),re=n(),C=d("p"),C.textContent=me,ne=n(),_=d("div"),p(D.$$.fragment),ie=n(),G=d("p"),G.textContent=ue,U=n(),p(F.$$.fragment),q=n(),z=d("p"),this.h()},l(e){const o=be("svelte-u9bgzb",document.head);f=a(o,"META",{name:!0,content:!0}),o.forEach(t),N=i(e),X=a(e,"P",{}),I(X).forEach(t),j=i(e),A(T.$$.fragment,e),E=i(e),A(S.$$.fragment,e),J=i(e),$=a(e,"P",{"data-svelte-h":!0}),V($)!=="svelte-g5z5pk"&&($.innerHTML=ae),K=i(e),A(v.$$.fragment,e),R=i(e),s=a(e,"DIV",{class:!0});var c=I(s);A(y.$$.fragment,c),Z=i(c),w=a(c,"P",{"data-svelte-h":!0}),V(w)!=="svelte-cole5l"&&(w.textContent=ce),ee=i(c),L=a(c,"P",{"data-svelte-h":!0}),V(L)!=="svelte-hb3xoq"&&(L.innerHTML=le),te=i(c),m=a(c,"DIV",{class:!0});var W=I(m);A(M.$$.fragment,W),oe=i(W),k=a(W,"P",{"data-svelte-h":!0}),V(k)!=="svelte-1vvom4r"&&(k.innerHTML=fe),W.forEach(t),se=i(c),u=a(c,"DIV",{class:!0});var B=I(u);A(x.$$.fragment,B),re=i(B),C=a(B,"P",{"data-svelte-h":!0}),V(C)!=="svelte-1o77hl2"&&(C.textContent=me),B.forEach(t),ne=i(c),_=a(c,"DIV",{class:!0});var Q=I(_);A(D.$$.fragment,Q),ie=i(Q),G=a(Q,"P",{"data-svelte-h":!0}),V(G)!=="svelte-1lxcwhv"&&(G.textContent=ue),Q.forEach(t),c.forEach(t),U=i(e),A(F.$$.fragment,e),q=i(e),z=a(e,"P",{}),I(z).forEach(t),this.h()},h(){H(f,"name","hf:doc:metadata"),H(f,"content",ve),H(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(s,"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,o){r(document.head,f),l(e,N,o),l(e,X,o),l(e,j,o),h(T,e,o),l(e,E,o),h(S,e,o),l(e,J,o),l(e,$,o),l(e,K,o),h(v,e,o),l(e,R,o),l(e,s,o),h(y,s,null),r(s,Z),r(s,w),r(s,ee),r(s,L),r(s,te),r(s,m),h(M,m,null),r(m,oe),r(m,k),r(s,se),r(s,u),h(x,u,null),r(u,re),r(u,C),r(s,ne),r(s,_),h(D,_,null),r(_,ie),r(_,G),l(e,U,o),h(F,e,o),l(e,q,o),l(e,z,o),O=!0},p:Ae,i(e){O||(g(T.$$.fragment,e),g(S.$$.fragment,e),g(v.$$.fragment,e),g(y.$$.fragment,e),g(M.$$.fragment,e),g(x.$$.fragment,e),g(D.$$.fragment,e),g(F.$$.fragment,e),O=!0)},o(e){P(T.$$.fragment,e),P(S.$$.fragment,e),P(v.$$.fragment,e),P(y.$$.fragment,e),P(M.$$.fragment,e),P(x.$$.fragment,e),P(D.$$.fragment,e),P(F.$$.fragment,e),O=!1},d(e){e&&(t(N),t(X),t(j),t(E),t(J),t($),t(K),t(R),t(s),t(U),t(q),t(z)),t(f),b(T,e),b(S,e),b(v,e),b(y),b(M),b(x),b(D),b(F,e)}}}const ve='{"title":"StableAudioDiTModel","local":"stableaudioditmodel","sections":[{"title":"StableAudioDiTModel","local":"diffusers.StableAudioDiTModel","sections":[],"depth":2}],"depth":1}';function ye(de){return he(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Le extends ge{constructor(f){super(),Pe(this,f,ye,$e,pe,{})}}export{Le as component};
