import{s as ie,n as me,o as de}from"../chunks/scheduler.53228c21.js";import{S as le,i as fe,e as i,s as r,c,h as pe,a as m,d as t,b as s,f as A,g as u,j as J,k as E,l as f,m as n,n as h,t as g,o as _,p as T}from"../chunks/index.100fac89.js";import{C as ce}from"../chunks/CopyLLMTxtMenu.2cdbb51f.js";import{D as ee}from"../chunks/Docstring.d46840f1.js";import{H as oe,E as ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.3fcbbc76.js";function he(te){let d,q,P,H,b,I,$,S,v,ne="A Transformer model for video-like data.",j,M,B,a,x,K,C,re="A Transformer model for video-like data.",Q,p,w,X,k,se="The <code>TransformerTemporal</code> forward method.",U,y,V,l,O,Y,z,ae='The output of <a href="/docs/diffusers/main/en/api/models/transformer_temporal#diffusers.TransformerTemporalModel">TransformerTemporalModel</a>.',F,L,G,D,R;return b=new ce({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),$=new oe({props:{title:"TransformerTemporalModel",local:"transformertemporalmodel",headingTag:"h1"}}),M=new oe({props:{title:"TransformerTemporalModel",local:"diffusers.TransformerTemporalModel",headingTag:"h2"}}),x=new ee({props:{name:"class diffusers.TransformerTemporalModel",anchor:"diffusers.TransformerTemporalModel",parameters:[{name:"num_attention_heads",val:": int = 16"},{name:"attention_head_dim",val:": int = 88"},{name:"in_channels",val:": typing.Optional[int] = None"},{name:"out_channels",val:": typing.Optional[int] = None"},{name:"num_layers",val:": int = 1"},{name:"dropout",val:": float = 0.0"},{name:"norm_num_groups",val:": int = 32"},{name:"cross_attention_dim",val:": typing.Optional[int] = None"},{name:"attention_bias",val:": bool = False"},{name:"sample_size",val:": typing.Optional[int] = None"},{name:"activation_fn",val:": str = 'geglu'"},{name:"norm_elementwise_affine",val:": bool = True"},{name:"double_self_attention",val:": bool = True"},{name:"positional_embeddings",val:": typing.Optional[str] = None"},{name:"num_positional_embeddings",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.TransformerTemporalModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014; The number of heads to use for multi-head attention.",name:"num_attention_heads"},{anchor:"diffusers.TransformerTemporalModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 88) &#x2014; The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.TransformerTemporalModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of channels in the input and output (specify if the input is <strong>continuous</strong>).`,name:"in_channels"},{anchor:"diffusers.TransformerTemporalModel.num_layers",description:"<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The number of layers of Transformer blocks to use.",name:"num_layers"},{anchor:"diffusers.TransformerTemporalModel.dropout",description:"<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014; The dropout probability to use.",name:"dropout"},{anchor:"diffusers.TransformerTemporalModel.cross_attention_dim",description:"<strong>cross_attention_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The number of <code>encoder_hidden_states</code> dimensions to use.",name:"cross_attention_dim"},{anchor:"diffusers.TransformerTemporalModel.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Configure if the <code>TransformerBlock</code> attention should contain a bias parameter.`,name:"attention_bias"},{anchor:"diffusers.TransformerTemporalModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, <em>optional</em>) &#x2014; The width of the latent images (specify if the input is <strong>discrete</strong>).
This is fixed during training since it is used to learn a number of position embeddings.`,name:"sample_size"},{anchor:"diffusers.TransformerTemporalModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;geglu&quot;</code>) &#x2014;
Activation function to use in feed-forward. See <code>diffusers.models.activations.get_activation</code> for supported
activation functions.`,name:"activation_fn"},{anchor:"diffusers.TransformerTemporalModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Configure if the <code>TransformerBlock</code> should use learnable elementwise affine parameters for normalization.`,name:"norm_elementwise_affine"},{anchor:"diffusers.TransformerTemporalModel.double_self_attention",description:`<strong>double_self_attention</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Configure if each <code>TransformerBlock</code> should contain two self-attention layers.`,name:"double_self_attention"},{anchor:"diffusers.TransformerTemporalModel.positional_embeddings",description:`<strong>positional_embeddings</strong> &#x2014; (<code>str</code>, <em>optional</em>):
The type of positional embeddings to apply to the sequence input before passing use.`,name:"positional_embeddings"},{anchor:"diffusers.TransformerTemporalModel.num_positional_embeddings",description:`<strong>num_positional_embeddings</strong> &#x2014; (<code>int</code>, <em>optional</em>):
The maximum length of the sequence over which to apply positional embeddings.`,name:"num_positional_embeddings"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_temporal.py#L41"}}),w=new ee({props:{name:"forward",anchor:"diffusers.TransformerTemporalModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": typing.Optional[torch.LongTensor] = None"},{name:"timestep",val:": typing.Optional[torch.LongTensor] = None"},{name:"class_labels",val:": LongTensor = None"},{name:"num_frames",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.TransformerTemporalModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.LongTensor</code> of shape <code>(batch size, num latent pixels)</code> if discrete, <code>torch.Tensor</code> of shape <code>(batch size, channel, height, width)</code> if continuous) &#x2014;
Input hidden_states.`,name:"hidden_states"},{anchor:"diffusers.TransformerTemporalModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> ( <code>torch.LongTensor</code> of shape <code>(batch size, encoder_hidden_states dim)</code>, <em>optional</em>) &#x2014;
Conditional embeddings for cross attention layer. If not given, cross-attention defaults to
self-attention.`,name:"encoder_hidden_states"},{anchor:"diffusers.TransformerTemporalModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Used to indicate denoising step. Optional timestep to be applied as an embedding in <code>AdaLayerNorm</code>.`,name:"timestep"},{anchor:"diffusers.TransformerTemporalModel.forward.class_labels",description:`<strong>class_labels</strong> ( <code>torch.LongTensor</code> of shape <code>(batch size, num classes)</code>, <em>optional</em>) &#x2014;
Used to indicate class labels conditioning. Optional class labels to be applied as an embedding in
<code>AdaLayerZeroNorm</code>.`,name:"class_labels"},{anchor:"diffusers.TransformerTemporalModel.forward.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of frames to be processed per batch. This is used to reshape the hidden states.`,name:"num_frames"},{anchor:"diffusers.TransformerTemporalModel.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>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.TransformerTemporalModel.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/main/en/api/models/transformer_temporal#diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput">TransformerTemporalModelOutput</a>
instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_temporal.py#L123",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is True, an
<a
  href="/docs/diffusers/main/en/api/models/transformer_temporal#diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput"
>TransformerTemporalModelOutput</a> is returned, otherwise a
<code>tuple</code> where the first element is the sample tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/models/transformer_temporal#diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput"
>TransformerTemporalModelOutput</a> or <code>tuple</code></p>
`}}),y=new oe({props:{title:"TransformerTemporalModelOutput",local:"diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput",headingTag:"h2"}}),O=new ee({props:{name:"class diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput",anchor:"diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput",parameters:[{name:"sample",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size x num_frames, num_channels, height, width)</code>) &#x2014;
The hidden states output conditioned on <code>encoder_hidden_states</code> input.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_temporal.py#L29"}}),L=new ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/transformer_temporal.md"}}),{c(){d=i("meta"),q=r(),P=i("p"),H=r(),c(b.$$.fragment),I=r(),c($.$$.fragment),S=r(),v=i("p"),v.textContent=ne,j=r(),c(M.$$.fragment),B=r(),a=i("div"),c(x.$$.fragment),K=r(),C=i("p"),C.textContent=re,Q=r(),p=i("div"),c(w.$$.fragment),X=r(),k=i("p"),k.innerHTML=se,U=r(),c(y.$$.fragment),V=r(),l=i("div"),c(O.$$.fragment),Y=r(),z=i("p"),z.innerHTML=ae,F=r(),c(L.$$.fragment),G=r(),D=i("p"),this.h()},l(e){const o=pe("svelte-u9bgzb",document.head);d=m(o,"META",{name:!0,content:!0}),o.forEach(t),q=s(e),P=m(e,"P",{}),A(P).forEach(t),H=s(e),u(b.$$.fragment,e),I=s(e),u($.$$.fragment,e),S=s(e),v=m(e,"P",{"data-svelte-h":!0}),J(v)!=="svelte-1ywwpi7"&&(v.textContent=ne),j=s(e),u(M.$$.fragment,e),B=s(e),a=m(e,"DIV",{class:!0});var N=A(a);u(x.$$.fragment,N),K=s(N),C=m(N,"P",{"data-svelte-h":!0}),J(C)!=="svelte-1ywwpi7"&&(C.textContent=re),Q=s(N),p=m(N,"DIV",{class:!0});var W=A(p);u(w.$$.fragment,W),X=s(W),k=m(W,"P",{"data-svelte-h":!0}),J(k)!=="svelte-14zjqkb"&&(k.innerHTML=se),W.forEach(t),N.forEach(t),U=s(e),u(y.$$.fragment,e),V=s(e),l=m(e,"DIV",{class:!0});var Z=A(l);u(O.$$.fragment,Z),Y=s(Z),z=m(Z,"P",{"data-svelte-h":!0}),J(z)!=="svelte-jr1b23"&&(z.innerHTML=ae),Z.forEach(t),F=s(e),u(L.$$.fragment,e),G=s(e),D=m(e,"P",{}),A(D).forEach(t),this.h()},h(){E(d,"name","hf:doc:metadata"),E(d,"content",ge),E(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(l,"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){f(document.head,d),n(e,q,o),n(e,P,o),n(e,H,o),h(b,e,o),n(e,I,o),h($,e,o),n(e,S,o),n(e,v,o),n(e,j,o),h(M,e,o),n(e,B,o),n(e,a,o),h(x,a,null),f(a,K),f(a,C),f(a,Q),f(a,p),h(w,p,null),f(p,X),f(p,k),n(e,U,o),h(y,e,o),n(e,V,o),n(e,l,o),h(O,l,null),f(l,Y),f(l,z),n(e,F,o),h(L,e,o),n(e,G,o),n(e,D,o),R=!0},p:me,i(e){R||(g(b.$$.fragment,e),g($.$$.fragment,e),g(M.$$.fragment,e),g(x.$$.fragment,e),g(w.$$.fragment,e),g(y.$$.fragment,e),g(O.$$.fragment,e),g(L.$$.fragment,e),R=!0)},o(e){_(b.$$.fragment,e),_($.$$.fragment,e),_(M.$$.fragment,e),_(x.$$.fragment,e),_(w.$$.fragment,e),_(y.$$.fragment,e),_(O.$$.fragment,e),_(L.$$.fragment,e),R=!1},d(e){e&&(t(q),t(P),t(H),t(I),t(S),t(v),t(j),t(B),t(a),t(U),t(V),t(l),t(F),t(G),t(D)),t(d),T(b,e),T($,e),T(M,e),T(x),T(w),T(y,e),T(O),T(L,e)}}}const ge='{"title":"TransformerTemporalModel","local":"transformertemporalmodel","sections":[{"title":"TransformerTemporalModel","local":"diffusers.TransformerTemporalModel","sections":[],"depth":2},{"title":"TransformerTemporalModelOutput","local":"diffusers.models.transformers.transformer_temporal.TransformerTemporalModelOutput","sections":[],"depth":2}],"depth":1}';function _e(te){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends le{constructor(d){super(),fe(this,d,_e,he,ie,{})}}export{xe as component};
