Buckets:
| import{s as Fe,o as ye,n as we}from"../chunks/scheduler.8c3d61f6.js";import{S as je,i as ke,g as c,s as a,r as _,A as Ce,h as m,f as r,c as i,j as z,u as g,x as T,k as H,y as o,a as f,v as $,d as b,t as x,w as v}from"../chunks/index.da70eac4.js";import{T as De}from"../chunks/Tip.1d9b8c37.js";import{D as J}from"../chunks/Docstring.6b390b9a.js";import{H as Me,E as Pe}from"../chunks/EditOnGithub.1e64e623.js";function Le(V){let t,u="This API is 🧪 experimental.";return{c(){t=c("p"),t.textContent=u},l(d){t=m(d,"P",{"data-svelte-h":!0}),T(t)!=="svelte-89q1io"&&(t.textContent=u)},m(d,D){f(d,t,D)},p:we,d(d){d&&r(t)}}}function Ee(V){let t,u="This API is 🧪 experimental.";return{c(){t=c("p"),t.textContent=u},l(d){t=m(d,"P",{"data-svelte-h":!0}),T(t)!=="svelte-89q1io"&&(t.textContent=u)},m(d,D){f(d,t,D)},p:we,d(d){d&&r(t)}}}function Ae(V){let t,u,d,D,j,X,k,_e='A Transformer model for image-like data from <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">Flux</a>.',Y,C,Z,s,P,re,O,ge="The Transformer model introduced in Flux.",se,S,$e='Reference: <a href="https://blackforestlabs.ai/announcing-black-forest-labs/" rel="nofollow">https://blackforestlabs.ai/announcing-black-forest-labs/</a>',ae,M,L,ie,U,be='The <a href="/docs/diffusers/pr_9245/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',de,p,E,le,K,xe=`Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, key, value) | |
| are fused. For cross-attention modules, key and value projection matrices are fused.`,ce,w,me,F,A,fe,Q,ve="Sets the attention processor to use to compute attention.",ue,h,I,pe,R,Te="Disables the fused QKV projection if enabled.",he,y,ee,N,te,B,oe;return j=new Me({props:{title:"FluxTransformer2DModel",local:"fluxtransformer2dmodel",headingTag:"h1"}}),C=new Me({props:{title:"FluxTransformer2DModel",local:"diffusers.FluxTransformer2DModel",headingTag:"h2"}}),P=new J({props:{name:"class diffusers.FluxTransformer2DModel",anchor:"diffusers.FluxTransformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"num_layers",val:": int = 19"},{name:"num_single_layers",val:": int = 38"},{name:"attention_head_dim",val:": int = 128"},{name:"num_attention_heads",val:": int = 24"},{name:"joint_attention_dim",val:": int = 4096"},{name:"pooled_projection_dim",val:": int = 768"},{name:"guidance_embeds",val:": bool = False"},{name:"axes_dims_rope",val:": Tuple = (16, 56, 56)"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.patch_size",description:"<strong>patch_size</strong> (<code>int</code>) — Patch size to turn the input data into small patches.",name:"patch_size"},{anchor:"diffusers.FluxTransformer2DModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 16) — The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.FluxTransformer2DModel.num_layers",description:"<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 18) — The number of layers of MMDiT blocks to use.",name:"num_layers"},{anchor:"diffusers.FluxTransformer2DModel.num_single_layers",description:"<strong>num_single_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 18) — The number of layers of single DiT blocks to use.",name:"num_single_layers"},{anchor:"diffusers.FluxTransformer2DModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) — The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.FluxTransformer2DModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 18) — The number of heads to use for multi-head attention.",name:"num_attention_heads"},{anchor:"diffusers.FluxTransformer2DModel.joint_attention_dim",description:"<strong>joint_attention_dim</strong> (<code>int</code>, <em>optional</em>) — The number of <code>encoder_hidden_states</code> dimensions to use.",name:"joint_attention_dim"},{anchor:"diffusers.FluxTransformer2DModel.pooled_projection_dim",description:"<strong>pooled_projection_dim</strong> (<code>int</code>) — Number of dimensions to use when projecting the <code>pooled_projections</code>.",name:"pooled_projection_dim"},{anchor:"diffusers.FluxTransformer2DModel.guidance_embeds",description:"<strong>guidance_embeds</strong> (<code>bool</code>, defaults to False) — Whether to use guidance embeddings.",name:"guidance_embeds"}],source:"https://github.com/huggingface/diffusers/blob/vr_9245/src/diffusers/models/transformers/transformer_flux.py#L206"}}),L=new J({props:{name:"forward",anchor:"diffusers.FluxTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor = None"},{name:"pooled_projections",val:": Tensor = None"},{name:"timestep",val:": LongTensor = None"},{name:"img_ids",val:": Tensor = None"},{name:"txt_ids",val:": Tensor = None"},{name:"guidance",val:": Tensor = None"},{name:"joint_attention_kwargs",val:": Optional = None"},{name:"controlnet_block_samples",val:" = None"},{name:"controlnet_single_block_samples",val:" = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, channel, height, width)</code>) — | |
| Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.FluxTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, sequence_len, embed_dims)</code>) — | |
| Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.FluxTransformer2DModel.forward.pooled_projections",description:`<strong>pooled_projections</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, projection_dim)</code>) — Embeddings projected | |
| from the embeddings of input conditions.`,name:"pooled_projections"},{anchor:"diffusers.FluxTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) — | |
| Used to indicate denoising step. | |
| block_controlnet_hidden_states — (<code>list</code> of <code>torch.Tensor</code>): | |
| A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"timestep"},{anchor:"diffusers.FluxTransformer2DModel.forward.joint_attention_kwargs",description:`<strong>joint_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) — | |
| 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:"joint_attention_kwargs"},{anchor:"diffusers.FluxTransformer2DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain | |
| tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_9245/src/diffusers/models/transformers/transformer_flux.py#L388",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> | |
| `}}),E=new J({props:{name:"fuse_qkv_projections",anchor:"diffusers.FluxTransformer2DModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9245/src/diffusers/models/transformers/transformer_flux.py#L345"}}),w=new De({props:{warning:!0,$$slots:{default:[Le]},$$scope:{ctx:V}}}),A=new J({props:{name:"set_attn_processor",anchor:"diffusers.FluxTransformer2DModel.set_attn_processor",parameters:[{name:"processor",val:": Union"}],parametersDescription:[{anchor:"diffusers.FluxTransformer2DModel.set_attn_processor.processor",description:`<strong>processor</strong> (<code>dict</code> of <code>AttentionProcessor</code> or only <code>AttentionProcessor</code>) — | |
| 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/vr_9245/src/diffusers/models/transformers/transformer_flux.py#L310"}}),I=new J({props:{name:"unfuse_qkv_projections",anchor:"diffusers.FluxTransformer2DModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9245/src/diffusers/models/transformers/transformer_flux.py#L371"}}),y=new De({props:{warning:!0,$$slots:{default:[Ee]},$$scope:{ctx:V}}}),N=new Pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/flux_transformer.md"}}),{c(){t=c("meta"),u=a(),d=c("p"),D=a(),_(j.$$.fragment),X=a(),k=c("p"),k.innerHTML=_e,Y=a(),_(C.$$.fragment),Z=a(),s=c("div"),_(P.$$.fragment),re=a(),O=c("p"),O.textContent=ge,se=a(),S=c("p"),S.innerHTML=$e,ae=a(),M=c("div"),_(L.$$.fragment),ie=a(),U=c("p"),U.innerHTML=be,de=a(),p=c("div"),_(E.$$.fragment),le=a(),K=c("p"),K.textContent=xe,ce=a(),_(w.$$.fragment),me=a(),F=c("div"),_(A.$$.fragment),fe=a(),Q=c("p"),Q.textContent=ve,ue=a(),h=c("div"),_(I.$$.fragment),pe=a(),R=c("p"),R.textContent=Te,he=a(),_(y.$$.fragment),ee=a(),_(N.$$.fragment),te=a(),B=c("p"),this.h()},l(e){const n=Ce("svelte-u9bgzb",document.head);t=m(n,"META",{name:!0,content:!0}),n.forEach(r),u=i(e),d=m(e,"P",{}),z(d).forEach(r),D=i(e),g(j.$$.fragment,e),X=i(e),k=m(e,"P",{"data-svelte-h":!0}),T(k)!=="svelte-e6h9db"&&(k.innerHTML=_e),Y=i(e),g(C.$$.fragment,e),Z=i(e),s=m(e,"DIV",{class:!0});var l=z(s);g(P.$$.fragment,l),re=i(l),O=m(l,"P",{"data-svelte-h":!0}),T(O)!=="svelte-19p4ty0"&&(O.textContent=ge),se=i(l),S=m(l,"P",{"data-svelte-h":!0}),T(S)!=="svelte-mxgguy"&&(S.innerHTML=$e),ae=i(l),M=m(l,"DIV",{class:!0});var q=z(M);g(L.$$.fragment,q),ie=i(q),U=m(q,"P",{"data-svelte-h":!0}),T(U)!=="svelte-1nemv8i"&&(U.innerHTML=be),q.forEach(r),de=i(l),p=m(l,"DIV",{class:!0});var W=z(p);g(E.$$.fragment,W),le=i(W),K=m(W,"P",{"data-svelte-h":!0}),T(K)!=="svelte-1254b9i"&&(K.textContent=xe),ce=i(W),g(w.$$.fragment,W),W.forEach(r),me=i(l),F=m(l,"DIV",{class:!0});var ne=z(F);g(A.$$.fragment,ne),fe=i(ne),Q=m(ne,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-1o77hl2"&&(Q.textContent=ve),ne.forEach(r),ue=i(l),h=m(l,"DIV",{class:!0});var G=z(h);g(I.$$.fragment,G),pe=i(G),R=m(G,"P",{"data-svelte-h":!0}),T(R)!=="svelte-1vhtc74"&&(R.textContent=Te),he=i(G),g(y.$$.fragment,G),G.forEach(r),l.forEach(r),ee=i(e),g(N.$$.fragment,e),te=i(e),B=m(e,"P",{}),z(B).forEach(r),this.h()},h(){H(t,"name","hf:doc:metadata"),H(t,"content",Ie),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(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(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,n){o(document.head,t),f(e,u,n),f(e,d,n),f(e,D,n),$(j,e,n),f(e,X,n),f(e,k,n),f(e,Y,n),$(C,e,n),f(e,Z,n),f(e,s,n),$(P,s,null),o(s,re),o(s,O),o(s,se),o(s,S),o(s,ae),o(s,M),$(L,M,null),o(M,ie),o(M,U),o(s,de),o(s,p),$(E,p,null),o(p,le),o(p,K),o(p,ce),$(w,p,null),o(s,me),o(s,F),$(A,F,null),o(F,fe),o(F,Q),o(s,ue),o(s,h),$(I,h,null),o(h,pe),o(h,R),o(h,he),$(y,h,null),f(e,ee,n),$(N,e,n),f(e,te,n),f(e,B,n),oe=!0},p(e,[n]){const l={};n&2&&(l.$$scope={dirty:n,ctx:e}),w.$set(l);const q={};n&2&&(q.$$scope={dirty:n,ctx:e}),y.$set(q)},i(e){oe||(b(j.$$.fragment,e),b(C.$$.fragment,e),b(P.$$.fragment,e),b(L.$$.fragment,e),b(E.$$.fragment,e),b(w.$$.fragment,e),b(A.$$.fragment,e),b(I.$$.fragment,e),b(y.$$.fragment,e),b(N.$$.fragment,e),oe=!0)},o(e){x(j.$$.fragment,e),x(C.$$.fragment,e),x(P.$$.fragment,e),x(L.$$.fragment,e),x(E.$$.fragment,e),x(w.$$.fragment,e),x(A.$$.fragment,e),x(I.$$.fragment,e),x(y.$$.fragment,e),x(N.$$.fragment,e),oe=!1},d(e){e&&(r(u),r(d),r(D),r(X),r(k),r(Y),r(Z),r(s),r(ee),r(te),r(B)),r(t),v(j,e),v(C,e),v(P),v(L),v(E),v(w),v(A),v(I),v(y),v(N,e)}}}const Ie='{"title":"FluxTransformer2DModel","local":"fluxtransformer2dmodel","sections":[{"title":"FluxTransformer2DModel","local":"diffusers.FluxTransformer2DModel","sections":[],"depth":2}],"depth":1}';function Ne(V){return ye(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends je{constructor(t){super(),ke(this,t,Ne,Ae,Fe,{})}}export{Se as component}; | |
Xet Storage Details
- Size:
- 13.5 kB
- Xet hash:
- 6fa34f29f18c8f0d2d4ca7ca97a6bfa464a9408be9c38347b8d97ac8f764c474
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.