import{s as se,n as ae,o as ie}from"../chunks/scheduler.8c3d61f6.js";import{S as de,i as me,g as i,s as n,r as $,A as le,h as d,f as t,c as s,j as A,u as w,x as W,k as D,y as f,a as r,v as M,d as x,t as y,w as O}from"../chunks/index.589a98e8.js";import{D as X}from"../chunks/Docstring.27406313.js";import{H as Y,E as fe}from"../chunks/EditOnGithub.e5a8d9cb.js";function ce(ee){let m,E,N,q,p,H,u,oe="A Transformer model for video-like data.",I,h,S,a,_,Z,L,te="A Transformer model for video-like data.",J,c,g,K,k,re="The <code>TransformerTemporal</code> forward method.",B,T,U,l,b,Q,C,ne="The output of <code>TransformerTemporalModel</code>.",V,v,j,P,F;return p=new Y({props:{title:"TransformerTemporalModel",local:"transformertemporalmodel",headingTag:"h1"}}),h=new Y({props:{title:"TransformerTemporalModel",local:"diffusers.models.TransformerTemporalModel",headingTag:"h2"}}),_=new X({props:{name:"class diffusers.models.TransformerTemporalModel",anchor:"diffusers.models.TransformerTemporalModel",parameters:[{name:"num_attention_heads",val:": int = 16"},{name:"attention_head_dim",val:": int = 88"},{name:"in_channels",val:": Optional = None"},{name:"out_channels",val:": Optional = 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:": Optional = None"},{name:"attention_bias",val:": bool = False"},{name:"sample_size",val:": Optional = 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:": Optional = None"},{name:"num_positional_embeddings",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.models.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.models.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.models.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.models.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.models.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.models.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.models.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.models.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.models.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.models.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.models.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.
positional_embeddings &#x2014; (<code>str</code>, <em>optional</em>):
The type of positional embeddings to apply to the sequence input before passing use.
num_positional_embeddings &#x2014; (<code>int</code>, <em>optional</em>):
The maximum length of the sequence over which to apply positional embeddings.`,name:"double_self_attention"}],source:"https://github.com/huggingface/diffusers/blob/vr_8269/src/diffusers/models/transformers/transformer_temporal.py#L41"}}),g=new X({props:{name:"forward",anchor:"diffusers.models.TransformerTemporalModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"timestep",val:": Optional = None"},{name:"class_labels",val:": LongTensor = None"},{name:"num_frames",val:": int = 1"},{name:"cross_attention_kwargs",val:": Optional = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.models.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.models.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.models.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.models.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.models.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.models.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.models.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/pr_8269/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/vr_8269/src/diffusers/models/transformers/transformer_temporal.py#L121",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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