import{s as $e,n as xe,o as ye}from"../chunks/scheduler.8c3d61f6.js";import{S as De,i as Ge,g as d,s as r,r as g,A as Me,h as a,f as t,c as n,j as C,u as h,x as A,k as L,y as s,a as c,v as P,d as b,t as v,w as T}from"../chunks/index.da70eac4.js";import{D as K}from"../chunks/Docstring.6b390b9a.js";import{H as Te,E as Fe}from"../chunks/EditOnGithub.1e64e623.js";function we(ue){let l,N,R,J,$,q,x,pe='A Transformer model accept multi-modal instruction to generate image from <a href="https://github.com/VectorSpaceLab/OmniGen/" rel="nofollow">OmniGen</a>.',W,y,j,o,D,te,k,_e="The Transformer model introduced in OmniGen.",oe,z,ge='Reference: <a href="https://arxiv.org/pdf/2409.11340" rel="nofollow">https://arxiv.org/pdf/2409.11340</a>',re,u,G,ne,V,he='The <a href="/docs/diffusers/pr_10148/en/api/models/omnigen_transformer#diffusers.OmniGenTransformer2DModel">OmniGenTransformer2DModel</a> forward method.',ie,m,M,de,H,Ae="get the multi-modal conditional embeddings",ae,I,Pe="Returns: torch.Tensor",fe,p,F,ce,X,be="Sets the attention processor to use to compute attention.",me,_,w,le,S,ve=`x: (N, T, patch_size*<em>2</em> C)
imgs: (N, H, W, C)`,B,O,Q,U,Y;return $=new Te({props:{title:"OmniGenTransformer2DModel",local:"omnigentransformer2dmodel",headingTag:"h1"}}),y=new Te({props:{title:"OmniGenTransformer2DModel",local:"diffusers.OmniGenTransformer2DModel",headingTag:"h2"}}),D=new K({props:{name:"class diffusers.OmniGenTransformer2DModel",anchor:"diffusers.OmniGenTransformer2DModel",parameters:[{name:"transformer_config",val:": typing.Dict"},{name:"patch_size",val:" = 2"},{name:"in_channels",val:" = 4"},{name:"pos_embed_max_size",val:": int = 192"}],parametersDescription:[{anchor:"diffusers.OmniGenTransformer2DModel.transformer_config",description:"<strong>transformer_config</strong> (<code>dict</code>) &#x2014; config for transformer layers. OmniGen-v1 use Phi3 as transformer backbone",name:"transformer_config"},{anchor:"diffusers.OmniGenTransformer2DModel.patch_size",description:"<strong>patch_size</strong> (<code>int</code>, defaults to 2) &#x2014; Patch size to turn the input data into small patches.",name:"patch_size"},{anchor:"diffusers.OmniGenTransformer2DModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.OmniGenTransformer2DModel.pos_embed_max_size",description:"<strong>pos_embed_max_size</strong> (<code>int</code>, <em>optional</em>, defaults to 192) &#x2014; The max size of pos emb.",name:"pos_embed_max_size"}],source:"https://github.com/huggingface/diffusers/blob/vr_10148/src/diffusers/models/transformers/transformer_omnigen.py#L216"}}),G=new K({props:{name:"forward",anchor:"diffusers.OmniGenTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": typing.Union[int, float, torch.LongTensor]"},{name:"input_ids",val:": Tensor"},{name:"input_img_latents",val:": typing.List[torch.Tensor]"},{name:"input_image_sizes",val:": typing.Dict[int, typing.List[int]]"},{name:"attention_mask",val:": Tensor"},{name:"position_ids",val:": Tensor"},{name:"past_key_values",val:": DynamicCache = None"},{name:"offload_transformer_block",val:": bool = False"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.OmniGenTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.FloatTensor</code> of shape <code>(batch size, channel, height, width)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code>) &#x2014;
token ids`,name:"input_ids"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.input_img_latents",description:`<strong>input_img_latents</strong> (<code>torch.FloatTensor</code>) &#x2014;
encoded image latents by VAE`,name:"input_img_latents"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.input_image_sizes",description:`<strong>input_image_sizes</strong> (<code>dict</code>) &#x2014;
the indices of the input_img_latents in the input_ids`,name:"input_image_sizes"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code>) &#x2014;
mask for self-attention`,name:"attention_mask"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code>) &#x2014;
id to represent position`,name:"position_ids"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>transformers.cache_utils.Cache</code>) &#x2014;
previous key and value states`,name:"past_key_values"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.offload_transformer_block",description:`<strong>offload_transformer_block</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
offload transformer block to cpu`,name:"offload_transformer_block"},{anchor:"diffusers.OmniGenTransformer2DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> &#x2014; (<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:"attention_kwargs"},{anchor:"diffusers.OmniGenTransformer2DModel.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>OmniGen2DModelOutput</code> instead of a plain
tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_10148/src/diffusers/models/transformers/transformer_omnigen.py#L371",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is True, an <code>OmniGen2DModelOutput</code> is returned, otherwise a
<code>tuple</code> where the first element is the sample tensor.</p>
`}}),M=new K({props:{name:"get_multimodal_embeddings",anchor:"diffusers.OmniGenTransformer2DModel.get_multimodal_embeddings",parameters:[{name:"input_ids",val:": Tensor"},{name:"input_img_latents",val:": typing.List[torch.Tensor]"},{name:"input_image_sizes",val:": typing.Dict"}],parametersDescription:[{anchor:"diffusers.OmniGenTransformer2DModel.get_multimodal_embeddings.input_ids",description:"<strong>input_ids</strong> &#x2014; a sequence of text id",name:"input_ids"},{anchor:"diffusers.OmniGenTransformer2DModel.get_multimodal_embeddings.input_img_latents",description:"<strong>input_img_latents</strong> &#x2014; continues embedding of input images",name:"input_img_latents"},{anchor:"diffusers.OmniGenTransformer2DModel.get_multimodal_embeddings.input_image_sizes",description:"<strong>input_image_sizes</strong> &#x2014; the index of the input image in the input_ids sequence.",name:"input_image_sizes"}],source:"https://github.com/huggingface/diffusers/blob/vr_10148/src/diffusers/models/transformers/transformer_omnigen.py#L338"}}),F=new K({props:{name:"set_attn_processor",anchor:"diffusers.OmniGenTransformer2DModel.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.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.MochiAttnProcessor2_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.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, 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.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.MochiAttnProcessor2_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.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, 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.OmniGenTransformer2DModel.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/vr_10148/src/diffusers/models/transformers/transformer_omnigen.py#L300"}}),w=new K({props:{name:"unpatchify",anchor:"diffusers.OmniGenTransformer2DModel.unpatchify",parameters:[{name:"x",val:""},{name:"h",val:""},{name:"w",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10148/src/diffusers/models/transformers/transformer_omnigen.py#L261"}}),O=new Fe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/omnigen_transformer.md"}}),{c(){l=d("meta"),N=r(),R=d("p"),J=r(),g($.$$.fragment),q=r(),x=d("p"),x.innerHTML=pe,W=r(),g(y.$$.fragment),j=r(),o=d("div"),g(D.$$.fragment),te=r(),k=d("p"),k.textContent=_e,oe=r(),z=d("p"),z.innerHTML=ge,re=r(),u=d("div"),g(G.$$.fragment),ne=r(),V=d("p"),V.innerHTML=he,ie=r(),m=d("div"),g(M.$$.fragment),de=r(),H=d("p"),H.textContent=Ae,ae=r(),I=d("p"),I.textContent=Pe,fe=r(),p=d("div"),g(F.$$.fragment),ce=r(),X=d("p"),X.textContent=be,me=r(),_=d("div"),g(w.$$.fragment),le=r(),S=d("p"),S.innerHTML=ve,B=r(),g(O.$$.fragment),Q=r(),U=d("p"),this.h()},l(e){const i=Me("svelte-u9bgzb",document.head);l=a(i,"META",{name:!0,content:!0}),i.forEach(t),N=n(e),R=a(e,"P",{}),C(R).forEach(t),J=n(e),h($.$$.fragment,e),q=n(e),x=a(e,"P",{"data-svelte-h":!0}),A(x)!=="svelte-koyp6y"&&(x.innerHTML=pe),W=n(e),h(y.$$.fragment,e),j=n(e),o=a(e,"DIV",{class:!0});var f=C(o);h(D.$$.fragment,f),te=n(f),k=a(f,"P",{"data-svelte-h":!0}),A(k)!=="svelte-1r9n2w8"&&(k.textContent=_e),oe=n(f),z=a(f,"P",{"data-svelte-h":!0}),A(z)!=="svelte-86snvu"&&(z.innerHTML=ge),re=n(f),u=a(f,"DIV",{class:!0});var Z=C(u);h(G.$$.fragment,Z),ne=n(Z),V=a(Z,"P",{"data-svelte-h":!0}),A(V)!=="svelte-wlzklk"&&(V.innerHTML=he),Z.forEach(t),ie=n(f),m=a(f,"DIV",{class:!0});var E=C(m);h(M.$$.fragment,E),de=n(E),H=a(E,"P",{"data-svelte-h":!0}),A(H)!=="svelte-1dmiuto"&&(H.textContent=Ae),ae=n(E),I=a(E,"P",{"data-svelte-h":!0}),A(I)!=="svelte-1c3z8g4"&&(I.textContent=Pe),E.forEach(t),fe=n(f),p=a(f,"DIV",{class:!0});var ee=C(p);h(F.$$.fragment,ee),ce=n(ee),X=a(ee,"P",{"data-svelte-h":!0}),A(X)!=="svelte-1o77hl2"&&(X.textContent=be),ee.forEach(t),me=n(f),_=a(f,"DIV",{class:!0});var se=C(_);h(w.$$.fragment,se),le=n(se),S=a(se,"P",{"data-svelte-h":!0}),A(S)!=="svelte-1iod296"&&(S.innerHTML=ve),se.forEach(t),f.forEach(t),B=n(e),h(O.$$.fragment,e),Q=n(e),U=a(e,"P",{}),C(U).forEach(t),this.h()},h(){L(l,"name","hf:doc:metadata"),L(l,"content",Oe),L(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(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,i){s(document.head,l),c(e,N,i),c(e,R,i),c(e,J,i),P($,e,i),c(e,q,i),c(e,x,i),c(e,W,i),P(y,e,i),c(e,j,i),c(e,o,i),P(D,o,null),s(o,te),s(o,k),s(o,oe),s(o,z),s(o,re),s(o,u),P(G,u,null),s(u,ne),s(u,V),s(o,ie),s(o,m),P(M,m,null),s(m,de),s(m,H),s(m,ae),s(m,I),s(o,fe),s(o,p),P(F,p,null),s(p,ce),s(p,X),s(o,me),s(o,_),P(w,_,null),s(_,le),s(_,S),c(e,B,i),P(O,e,i),c(e,Q,i),c(e,U,i),Y=!0},p:xe,i(e){Y||(b($.$$.fragment,e),b(y.$$.fragment,e),b(D.$$.fragment,e),b(G.$$.fragment,e),b(M.$$.fragment,e),b(F.$$.fragment,e),b(w.$$.fragment,e),b(O.$$.fragment,e),Y=!0)},o(e){v($.$$.fragment,e),v(y.$$.fragment,e),v(D.$$.fragment,e),v(G.$$.fragment,e),v(M.$$.fragment,e),v(F.$$.fragment,e),v(w.$$.fragment,e),v(O.$$.fragment,e),Y=!1},d(e){e&&(t(N),t(R),t(J),t(q),t(x),t(W),t(j),t(o),t(B),t(Q),t(U)),t(l),T($,e),T(y,e),T(D),T(G),T(M),T(F),T(w),T(O,e)}}}const Oe='{"title":"OmniGenTransformer2DModel","local":"omnigentransformer2dmodel","sections":[{"title":"OmniGenTransformer2DModel","local":"diffusers.OmniGenTransformer2DModel","sections":[],"depth":2}],"depth":1}';function Ce(ue){return ye(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class He extends De{constructor(l){super(),Ge(this,l,Ce,we,$e,{})}}export{He as component};
