import{s as te,n as ne,o as oe}from"../chunks/scheduler.53228c21.js";import{S as re,i as se,e as d,s as r,c as C,h as ae,a as m,d as n,b as s,f as S,g as D,j as R,k as U,l,m as a,n as M,t as y,o as w,p as k}from"../chunks/index.100fac89.js";import{C as ie}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{D as Z}from"../chunks/Docstring.22cc8849.js";import{H as ee,E as de}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";function me(J){let i,j,L,N,h,z,u,E,p,K='A modified flux Transformer model from <a href="https://huggingface.co/lodestones/Chroma" rel="nofollow">Chroma</a>',H,_,A,o,g,V,$,Q="The Transformer model introduced in Flux, modified for Chroma.",G,x,X='Reference: <a href="https://huggingface.co/lodestones/Chroma" rel="nofollow">https://huggingface.co/lodestones/Chroma</a>',W,c,T,B,v,Y='The <a href="/docs/diffusers/main/en/api/models/flux_transformer#diffusers.FluxTransformer2DModel">FluxTransformer2DModel</a> forward method.',I,b,O,P,q;return h=new ie({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),u=new ee({props:{title:"ChromaTransformer2DModel",local:"chromatransformer2dmodel",headingTag:"h1"}}),_=new ee({props:{title:"ChromaTransformer2DModel",local:"diffusers.ChromaTransformer2DModel",headingTag:"h2"}}),g=new Z({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#L370"}}),T=new Z({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#L476",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>
`}}),b=new de({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/chroma_transformer.md"}}),{c(){i=d("meta"),j=r(),L=d("p"),N=r(),C(h.$$.fragment),z=r(),C(u.$$.fragment),E=r(),p=d("p"),p.innerHTML=K,H=r(),C(_.$$.fragment),A=r(),o=d("div"),C(g.$$.fragment),V=r(),$=d("p"),$.textContent=Q,G=r(),x=d("p"),x.innerHTML=X,W=r(),c=d("div"),C(T.$$.fragment),B=r(),v=d("p"),v.innerHTML=Y,I=r(),C(b.$$.fragment),O=r(),P=d("p"),this.h()},l(e){const t=ae("svelte-u9bgzb",document.head);i=m(t,"META",{name:!0,content:!0}),t.forEach(n),j=s(e),L=m(e,"P",{}),S(L).forEach(n),N=s(e),D(h.$$.fragment,e),z=s(e),D(u.$$.fragment,e),E=s(e),p=m(e,"P",{"data-svelte-h":!0}),R(p)!=="svelte-1oll8n3"&&(p.innerHTML=K),H=s(e),D(_.$$.fragment,e),A=s(e),o=m(e,"DIV",{class:!0});var f=S(o);D(g.$$.fragment,f),V=s(f),$=m(f,"P",{"data-svelte-h":!0}),R($)!=="svelte-x7vpty"&&($.textContent=Q),G=s(f),x=m(f,"P",{"data-svelte-h":!0}),R(x)!=="svelte-140bfqy"&&(x.innerHTML=X),W=s(f),c=m(f,"DIV",{class:!0});var F=S(c);D(T.$$.fragment,F),B=s(F),v=m(F,"P",{"data-svelte-h":!0}),R(v)!=="svelte-4l0nim"&&(v.innerHTML=Y),F.forEach(n),f.forEach(n),I=s(e),D(b.$$.fragment,e),O=s(e),P=m(e,"P",{}),S(P).forEach(n),this.h()},h(){U(i,"name","hf:doc:metadata"),U(i,"content",le),U(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(o,"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){l(document.head,i),a(e,j,t),a(e,L,t),a(e,N,t),M(h,e,t),a(e,z,t),M(u,e,t),a(e,E,t),a(e,p,t),a(e,H,t),M(_,e,t),a(e,A,t),a(e,o,t),M(g,o,null),l(o,V),l(o,$),l(o,G),l(o,x),l(o,W),l(o,c),M(T,c,null),l(c,B),l(c,v),a(e,I,t),M(b,e,t),a(e,O,t),a(e,P,t),q=!0},p:ne,i(e){q||(y(h.$$.fragment,e),y(u.$$.fragment,e),y(_.$$.fragment,e),y(g.$$.fragment,e),y(T.$$.fragment,e),y(b.$$.fragment,e),q=!0)},o(e){w(h.$$.fragment,e),w(u.$$.fragment,e),w(_.$$.fragment,e),w(g.$$.fragment,e),w(T.$$.fragment,e),w(b.$$.fragment,e),q=!1},d(e){e&&(n(j),n(L),n(N),n(z),n(E),n(p),n(H),n(A),n(o),n(I),n(O),n(P)),n(i),k(h,e),k(u,e),k(_,e),k(g),k(T),k(b,e)}}}const le='{"title":"ChromaTransformer2DModel","local":"chromatransformer2dmodel","sections":[{"title":"ChromaTransformer2DModel","local":"diffusers.ChromaTransformer2DModel","sections":[],"depth":2}],"depth":1}';function ce(J){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends re{constructor(i){super(),se(this,i,ce,me,te,{})}}export{ge as component};
