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