import{s as ye,o as De,n as xe}from"../chunks/scheduler.8c3d61f6.js";import{S as Fe,i as Me,g as f,s as a,r as h,A as we,h as l,f as r,c as i,j as H,u as g,x as T,k as N,y as t,a as m,v as A,d as P,t as $,w as b}from"../chunks/index.da70eac4.js";import{T as ve}from"../chunks/Tip.1d9b8c37.js";import{D as W}from"../chunks/Docstring.a42c214b.js";import{H as Ce,E as Le}from"../chunks/getInferenceSnippets.a8672208.js";function Se(X){let o,u="This API is 🧪 experimental.";return{c(){o=f("p"),o.textContent=u},l(d){o=l(d,"P",{"data-svelte-h":!0}),T(o)!=="svelte-89q1io"&&(o.textContent=u)},m(d,v){m(d,o,v)},p:xe,d(d){d&&r(o)}}}function Ge(X){let o,u="This API is 🧪 experimental.";return{c(){o=f("p"),o.textContent=u},l(d){o=l(d,"P",{"data-svelte-h":!0}),T(o)!=="svelte-89q1io"&&(o.textContent=u)},m(d,v){m(d,o,v)},p:xe,d(d){d&&r(o)}}}function Ie(X){let o,u,d,v,F,B,M,he='A modified flux Transformer model from <a href="https://huggingface.co/lodestones/Chroma" rel="nofollow">Chroma</a>',Y,w,Z,n,L,re,E,ge="The Transformer model introduced in Flux, modified for Chroma.",ne,K,Ae='Reference: <a href="https://huggingface.co/lodestones/Chroma" rel="nofollow">https://huggingface.co/lodestones/Chroma</a>',ae,C,S,ie,q,Pe='The <a href="/docs/diffusers/main/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',de,_,G,ce,J,$e=`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.`,fe,x,le,y,I,me,R,be="Sets the attention processor to use to compute attention.",ue,p,k,_e,U,Te="Disables the fused QKV projection if enabled.",pe,D,ee,V,oe,Q,te;return F=new Ce({props:{title:"ChromaTransformer2DModel",local:"chromatransformer2dmodel",headingTag:"h1"}}),w=new Ce({props:{title:"ChromaTransformer2DModel",local:"diffusers.ChromaTransformer2DModel",headingTag:"h2"}}),L=new W({props:{name:"class diffusers.ChromaTransformer2DModel",anchor:"diffusers.ChromaTransformer2DModel",parameters:[{name:"patch_size",val:": int = 1"},{name:"in_channels",val:": int = 64"},{name:"out_channels",val:": typing.Optional[int] = None"},{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:"axes_dims_rope",val:": typing.Tuple[int, ...] = (16, 56, 56)"},{name:"approximator_num_channels",val:": int = 64"},{name:"approximator_hidden_dim",val:": int = 5120"},{name:"approximator_layers",val:": int = 5"}],parametersDescription:[{anchor:"diffusers.ChromaTransformer2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
Patch size to turn the input data into small patches.`,name:"patch_size"},{anchor:"diffusers.ChromaTransformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>64</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.ChromaTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of channels in the output. If not specified, it defaults to <code>in_channels</code>.`,name:"out_channels"},{anchor:"diffusers.ChromaTransformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>19</code>) &#x2014;
The number of layers of dual stream DiT blocks to use.`,name:"num_layers"},{anchor:"diffusers.ChromaTransformer2DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>38</code>) &#x2014;
The number of layers of single stream DiT blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.ChromaTransformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of dimensions to use for each attention head.`,name:"attention_head_dim"},{anchor:"diffusers.ChromaTransformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) &#x2014;
The number of attention heads to use.`,name:"num_attention_heads"},{anchor:"diffusers.ChromaTransformer2DModel.joint_attention_dim",description:`<strong>joint_attention_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
The number of dimensions to use for the joint attention (embedding/channel dimension of
<code>encoder_hidden_states</code>).`,name:"joint_attention_dim"},{anchor:"diffusers.ChromaTransformer2DModel.axes_dims_rope",description:`<strong>axes_dims_rope</strong> (<code>Tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) &#x2014;
The dimensions to use for the rotary positional embeddings.`,name:"axes_dims_rope"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_chroma.py#L378"}}),S=new W({props:{name:"forward",anchor:"diffusers.ChromaTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor = None"},{name:"timestep",val:": LongTensor = None"},{name:"img_ids",val:": Tensor = None"},{name:"txt_ids",val:": Tensor = None"},{name:"attention_mask",val:": Tensor = None"},{name:"joint_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"controlnet_block_samples",val:" = None"},{name:"controlnet_single_block_samples",val:" = None"},{name:"return_dict",val:": bool = True"},{name:"controlnet_blocks_repeat",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.ChromaTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, image_sequence_length, in_channels)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.ChromaTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, text_sequence_length, joint_attention_dim)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.ChromaTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.ChromaTransformer2DModel.forward.block_controlnet_hidden_states",description:`<strong>block_controlnet_hidden_states</strong> &#x2014; (<code>list</code> of <code>torch.Tensor</code>):
A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"block_controlnet_hidden_states"},{anchor:"diffusers.ChromaTransformer2DModel.forward.joint_attention_kwargs",description:`<strong>joint_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:"joint_attention_kwargs"},{anchor:"diffusers.ChromaTransformer2DModel.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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_chroma.py#L578",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>
`}}),G=new W({props:{name:"fuse_qkv_projections",anchor:"diffusers.ChromaTransformer2DModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_chroma.py#L539"}}),x=new ve({props:{warning:!0,$$slots:{default:[Se]},$$scope:{ctx:X}}}),I=new W({props:{name:"set_attn_processor",anchor:"diffusers.ChromaTransformer2DModel.set_attn_processor",parameters:[{name:"processor",val:": typing.Union[diffusers.models.attention_processor.AttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor2_0, diffusers.models.attention_processor.JointAttnProcessor2_0, diffusers.models.attention_processor.PAGJointAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGJointAttnProcessor2_0, diffusers.models.attention_processor.FusedJointAttnProcessor2_0, diffusers.models.attention_processor.AllegroAttnProcessor2_0, diffusers.models.attention_processor.AuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FusedAuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.CogVideoXAttnProcessor2_0, diffusers.models.attention_processor.FusedCogVideoXAttnProcessor2_0, diffusers.models.attention_processor.XFormersAttnAddedKVProcessor, diffusers.models.attention_processor.XFormersAttnProcessor, diffusers.models.attention_processor.XLAFlashAttnProcessor2_0, diffusers.models.attention_processor.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_0, diffusers.models.attention_processor.MochiAttnProcessor2_0, diffusers.models.attention_processor.StableAudioAttnProcessor2_0, diffusers.models.attention_processor.HunyuanAttnProcessor2_0, diffusers.models.attention_processor.FusedHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.LuminaAttnProcessor2_0, diffusers.models.attention_processor.FusedAttnProcessor2_0, diffusers.models.attention_processor.CustomDiffusionXFormersAttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor2_0, diffusers.models.attention_processor.SlicedAttnProcessor, diffusers.models.attention_processor.SlicedAttnAddedKVProcessor, diffusers.models.attention_processor.SanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGSanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySanaLinearAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleLinearAttention, diffusers.models.attention_processor.SanaMultiscaleAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleAttentionProjection, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.SD3IPAdapterJointAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.LoRAAttnProcessor, diffusers.models.attention_processor.LoRAAttnProcessor2_0, diffusers.models.attention_processor.LoRAXFormersAttnProcessor, diffusers.models.attention_processor.LoRAAttnAddedKVProcessor, typing.Dict[str, typing.Union[diffusers.models.attention_processor.AttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor2_0, diffusers.models.attention_processor.JointAttnProcessor2_0, diffusers.models.attention_processor.PAGJointAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGJointAttnProcessor2_0, diffusers.models.attention_processor.FusedJointAttnProcessor2_0, diffusers.models.attention_processor.AllegroAttnProcessor2_0, diffusers.models.attention_processor.AuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FusedAuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.CogVideoXAttnProcessor2_0, diffusers.models.attention_processor.FusedCogVideoXAttnProcessor2_0, diffusers.models.attention_processor.XFormersAttnAddedKVProcessor, diffusers.models.attention_processor.XFormersAttnProcessor, diffusers.models.attention_processor.XLAFlashAttnProcessor2_0, diffusers.models.attention_processor.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_0, diffusers.models.attention_processor.MochiAttnProcessor2_0, diffusers.models.attention_processor.StableAudioAttnProcessor2_0, diffusers.models.attention_processor.HunyuanAttnProcessor2_0, diffusers.models.attention_processor.FusedHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.LuminaAttnProcessor2_0, diffusers.models.attention_processor.FusedAttnProcessor2_0, diffusers.models.attention_processor.CustomDiffusionXFormersAttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor2_0, diffusers.models.attention_processor.SlicedAttnProcessor, diffusers.models.attention_processor.SlicedAttnAddedKVProcessor, diffusers.models.attention_processor.SanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGSanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySanaLinearAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleLinearAttention, diffusers.models.attention_processor.SanaMultiscaleAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleAttentionProjection, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.SD3IPAdapterJointAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.LoRAAttnProcessor, diffusers.models.attention_processor.LoRAAttnProcessor2_0, diffusers.models.attention_processor.LoRAXFormersAttnProcessor, diffusers.models.attention_processor.LoRAAttnAddedKVProcessor]]]"}],parametersDescription:[{anchor:"diffusers.ChromaTransformer2DModel.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/transformer_chroma.py#L504"}}),k=new W({props:{name:"unfuse_qkv_projections",anchor:"diffusers.ChromaTransformer2DModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_chroma.py#L565"}}),D=new ve({props:{warning:!0,$$slots:{default:[Ge]},$$scope:{ctx:X}}}),V=new Le({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/chroma_transformer.md"}}),{c(){o=f("meta"),u=a(),d=f("p"),v=a(),h(F.$$.fragment),B=a(),M=f("p"),M.innerHTML=he,Y=a(),h(w.$$.fragment),Z=a(),n=f("div"),h(L.$$.fragment),re=a(),E=f("p"),E.textContent=ge,ne=a(),K=f("p"),K.innerHTML=Ae,ae=a(),C=f("div"),h(S.$$.fragment),ie=a(),q=f("p"),q.innerHTML=Pe,de=a(),_=f("div"),h(G.$$.fragment),ce=a(),J=f("p"),J.textContent=$e,fe=a(),h(x.$$.fragment),le=a(),y=f("div"),h(I.$$.fragment),me=a(),R=f("p"),R.textContent=be,ue=a(),p=f("div"),h(k.$$.fragment),_e=a(),U=f("p"),U.textContent=Te,pe=a(),h(D.$$.fragment),ee=a(),h(V.$$.fragment),oe=a(),Q=f("p"),this.h()},l(e){const s=we("svelte-u9bgzb",document.head);o=l(s,"META",{name:!0,content:!0}),s.forEach(r),u=i(e),d=l(e,"P",{}),H(d).forEach(r),v=i(e),g(F.$$.fragment,e),B=i(e),M=l(e,"P",{"data-svelte-h":!0}),T(M)!=="svelte-1oll8n3"&&(M.innerHTML=he),Y=i(e),g(w.$$.fragment,e),Z=i(e),n=l(e,"DIV",{class:!0});var c=H(n);g(L.$$.fragment,c),re=i(c),E=l(c,"P",{"data-svelte-h":!0}),T(E)!=="svelte-x7vpty"&&(E.textContent=ge),ne=i(c),K=l(c,"P",{"data-svelte-h":!0}),T(K)!=="svelte-140bfqy"&&(K.innerHTML=Ae),ae=i(c),C=l(c,"DIV",{class:!0});var j=H(C);g(S.$$.fragment,j),ie=i(j),q=l(j,"P",{"data-svelte-h":!0}),T(q)!=="svelte-4l0nim"&&(q.innerHTML=Pe),j.forEach(r),de=i(c),_=l(c,"DIV",{class:!0});var z=H(_);g(G.$$.fragment,z),ce=i(z),J=l(z,"P",{"data-svelte-h":!0}),T(J)!=="svelte-1254b9i"&&(J.textContent=$e),fe=i(z),g(x.$$.fragment,z),z.forEach(r),le=i(c),y=l(c,"DIV",{class:!0});var se=H(y);g(I.$$.fragment,se),me=i(se),R=l(se,"P",{"data-svelte-h":!0}),T(R)!=="svelte-1o77hl2"&&(R.textContent=be),se.forEach(r),ue=i(c),p=l(c,"DIV",{class:!0});var O=H(p);g(k.$$.fragment,O),_e=i(O),U=l(O,"P",{"data-svelte-h":!0}),T(U)!=="svelte-1vhtc74"&&(U.textContent=Te),pe=i(O),g(D.$$.fragment,O),O.forEach(r),c.forEach(r),ee=i(e),g(V.$$.fragment,e),oe=i(e),Q=l(e,"P",{}),H(Q).forEach(r),this.h()},h(){N(o,"name","hf:doc:metadata"),N(o,"content",ke),N(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(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,s){t(document.head,o),m(e,u,s),m(e,d,s),m(e,v,s),A(F,e,s),m(e,B,s),m(e,M,s),m(e,Y,s),A(w,e,s),m(e,Z,s),m(e,n,s),A(L,n,null),t(n,re),t(n,E),t(n,ne),t(n,K),t(n,ae),t(n,C),A(S,C,null),t(C,ie),t(C,q),t(n,de),t(n,_),A(G,_,null),t(_,ce),t(_,J),t(_,fe),A(x,_,null),t(n,le),t(n,y),A(I,y,null),t(y,me),t(y,R),t(n,ue),t(n,p),A(k,p,null),t(p,_e),t(p,U),t(p,pe),A(D,p,null),m(e,ee,s),A(V,e,s),m(e,oe,s),m(e,Q,s),te=!0},p(e,[s]){const c={};s&2&&(c.$$scope={dirty:s,ctx:e}),x.$set(c);const j={};s&2&&(j.$$scope={dirty:s,ctx:e}),D.$set(j)},i(e){te||(P(F.$$.fragment,e),P(w.$$.fragment,e),P(L.$$.fragment,e),P(S.$$.fragment,e),P(G.$$.fragment,e),P(x.$$.fragment,e),P(I.$$.fragment,e),P(k.$$.fragment,e),P(D.$$.fragment,e),P(V.$$.fragment,e),te=!0)},o(e){$(F.$$.fragment,e),$(w.$$.fragment,e),$(L.$$.fragment,e),$(S.$$.fragment,e),$(G.$$.fragment,e),$(x.$$.fragment,e),$(I.$$.fragment,e),$(k.$$.fragment,e),$(D.$$.fragment,e),$(V.$$.fragment,e),te=!1},d(e){e&&(r(u),r(d),r(v),r(B),r(M),r(Y),r(Z),r(n),r(ee),r(oe),r(Q)),r(o),b(F,e),b(w,e),b(L),b(S),b(G),b(x),b(I),b(k),b(D),b(V,e)}}}const ke='{"title":"ChromaTransformer2DModel","local":"chromatransformer2dmodel","sections":[{"title":"ChromaTransformer2DModel","local":"diffusers.ChromaTransformer2DModel","sections":[],"depth":2}],"depth":1}';function Ve(X){return De(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ke extends Fe{constructor(o){super(),Me(this,o,Ve,Ie,ye,{})}}export{Ke as component};
