import{s as fe,n as pe,o as _e}from"../chunks/scheduler.8c3d61f6.js";import{S as he,i as ge,g as i,s as a,r as M,A as be,h as d,f as t,c as r,j as I,u as x,x as E,k as j,y as s,a as c,v as A,d as S,t as y,w as k}from"../chunks/index.da70eac4.js";import{D as Q}from"../chunks/Docstring.6b390b9a.js";import{H as ue,E as Te}from"../chunks/EditOnGithub.1e64e623.js";function ve(ae){let m,F,q,N,_,O,h,re='A Transformer model for audio waveforms from <a href="https://huggingface.co/papers/2407.14358" rel="nofollow">Stable Audio Open</a>.',V,g,U,o,b,X,w,ie="The Diffusion Transformer model introduced in Stable Audio.",Y,C,de='Reference: <a href="https://github.com/Stability-AI/stable-audio-tools" rel="nofollow">https://github.com/Stability-AI/stable-audio-tools</a>',Z,u,T,ee,P,le='The <a href="/docs/diffusers/main/en/api/models/stable_audio_transformer#diffusers.StableAudioDiTModel">StableAudioDiTModel</a> forward method.',te,f,v,oe,L,ce="Sets the attention processor to use to compute attention.",ne,p,$,se,z,me="Disables custom attention processors and sets the default attention implementation.",G,D,R,H,W;return _=new ue({props:{title:"StableAudioDiTModel",local:"stableaudioditmodel",headingTag:"h1"}}),g=new ue({props:{title:"StableAudioDiTModel",local:"diffusers.StableAudioDiTModel",headingTag:"h2"}}),b=new Q({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#L190"}}),T=new Q({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:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = 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#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>
`}}),v=new Q({props:{name:"set_attn_processor",anchor:"diffusers.StableAudioDiTModel.set_attn_processor",parameters:[{name:"processor",val:": Union"}],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#L307"}}),$=new Q({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#L342"}}),D=new Te({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/stable_audio_transformer.md"}}),{c(){m=i("meta"),F=a(),q=i("p"),N=a(),M(_.$$.fragment),O=a(),h=i("p"),h.innerHTML=re,V=a(),M(g.$$.fragment),U=a(),o=i("div"),M(b.$$.fragment),X=a(),w=i("p"),w.textContent=ie,Y=a(),C=i("p"),C.innerHTML=de,Z=a(),u=i("div"),M(T.$$.fragment),ee=a(),P=i("p"),P.innerHTML=le,te=a(),f=i("div"),M(v.$$.fragment),oe=a(),L=i("p"),L.textContent=ce,ne=a(),p=i("div"),M($.$$.fragment),se=a(),z=i("p"),z.textContent=me,G=a(),M(D.$$.fragment),R=a(),H=i("p"),this.h()},l(e){const n=be("svelte-u9bgzb",document.head);m=d(n,"META",{name:!0,content:!0}),n.forEach(t),F=r(e),q=d(e,"P",{}),I(q).forEach(t),N=r(e),x(_.$$.fragment,e),O=r(e),h=d(e,"P",{"data-svelte-h":!0}),E(h)!=="svelte-g5z5pk"&&(h.innerHTML=re),V=r(e),x(g.$$.fragment,e),U=r(e),o=d(e,"DIV",{class:!0});var l=I(o);x(b.$$.fragment,l),X=r(l),w=d(l,"P",{"data-svelte-h":!0}),E(w)!=="svelte-cole5l"&&(w.textContent=ie),Y=r(l),C=d(l,"P",{"data-svelte-h":!0}),E(C)!=="svelte-hb3xoq"&&(C.innerHTML=de),Z=r(l),u=d(l,"DIV",{class:!0});var B=I(u);x(T.$$.fragment,B),ee=r(B),P=d(B,"P",{"data-svelte-h":!0}),E(P)!=="svelte-1vvom4r"&&(P.innerHTML=le),B.forEach(t),te=r(l),f=d(l,"DIV",{class:!0});var J=I(f);x(v.$$.fragment,J),oe=r(J),L=d(J,"P",{"data-svelte-h":!0}),E(L)!=="svelte-1o77hl2"&&(L.textContent=ce),J.forEach(t),ne=r(l),p=d(l,"DIV",{class:!0});var K=I(p);x($.$$.fragment,K),se=r(K),z=d(K,"P",{"data-svelte-h":!0}),E(z)!=="svelte-1lxcwhv"&&(z.textContent=me),K.forEach(t),l.forEach(t),G=r(e),x(D.$$.fragment,e),R=r(e),H=d(e,"P",{}),I(H).forEach(t),this.h()},h(){j(m,"name","hf:doc:metadata"),j(m,"content",$e),j(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(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,n){s(document.head,m),c(e,F,n),c(e,q,n),c(e,N,n),A(_,e,n),c(e,O,n),c(e,h,n),c(e,V,n),A(g,e,n),c(e,U,n),c(e,o,n),A(b,o,null),s(o,X),s(o,w),s(o,Y),s(o,C),s(o,Z),s(o,u),A(T,u,null),s(u,ee),s(u,P),s(o,te),s(o,f),A(v,f,null),s(f,oe),s(f,L),s(o,ne),s(o,p),A($,p,null),s(p,se),s(p,z),c(e,G,n),A(D,e,n),c(e,R,n),c(e,H,n),W=!0},p:pe,i(e){W||(S(_.$$.fragment,e),S(g.$$.fragment,e),S(b.$$.fragment,e),S(T.$$.fragment,e),S(v.$$.fragment,e),S($.$$.fragment,e),S(D.$$.fragment,e),W=!0)},o(e){y(_.$$.fragment,e),y(g.$$.fragment,e),y(b.$$.fragment,e),y(T.$$.fragment,e),y(v.$$.fragment,e),y($.$$.fragment,e),y(D.$$.fragment,e),W=!1},d(e){e&&(t(F),t(q),t(N),t(O),t(h),t(V),t(U),t(o),t(G),t(R),t(H)),t(m),k(_,e),k(g,e),k(b),k(T),k(v),k($),k(D,e)}}}const $e='{"title":"StableAudioDiTModel","local":"stableaudioditmodel","sections":[{"title":"StableAudioDiTModel","local":"diffusers.StableAudioDiTModel","sections":[],"depth":2}],"depth":1}';function De(ae){return _e(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ye extends he{constructor(m){super(),ge(this,m,De,ve,fe,{})}}export{ye as component};
