Buckets:

download
raw
11.1 kB
import{s as te,n as oe,o as ne}from"../chunks/scheduler.53228c21.js";import{S as re,i as ae,e as i,s as r,c as M,h as se,a as m,d as o,b as a,f as U,g as D,j as G,k as F,l as c,m as s,n as w,t as y,o as I,p as k}from"../chunks/index.cac5d66a.js";import{C as de}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as Z}from"../chunks/Docstring.9de32ff4.js";import{H as ee,E as ie}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function me(W){let d,L,P,E,h,q,p,C,u,J='A transformer for image-like data from <a href="https://github.com/ideogram-oss/ideogram-4" rel="nofollow">Ideogram 4</a>.',N,g,O,n,_,V,x,Q="The flow-matching transformer backbone used by the Ideogram 4 pipeline.",j,$,X=`The transformer operates on a single packed sequence containing both text-conditioning tokens (produced by a
multimodal text encoder) and the patchified image latents. Per-token indicators distinguish the two roles, and a
block-diagonal attention mask derived from <code>segment_ids</code> restricts each sample to attend only to itself within a
packed batch.`,B,l,T,K,v,Y="Predict the flow-matching velocity for the image-token positions of the packed sequence.",A,b,R,z,H;return h=new de({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new ee({props:{title:"Ideogram4Transformer2DModel",local:"ideogram4transformer2dmodel",headingTag:"h1"}}),g=new ee({props:{title:"Ideogram4Transformer2DModel",local:"diffusers.Ideogram4Transformer2DModel",headingTag:"h2"}}),_=new Z({props:{name:"class diffusers.Ideogram4Transformer2DModel",anchor:"diffusers.Ideogram4Transformer2DModel",parameters:[{name:"in_channels",val:": int = 128"},{name:"num_layers",val:": int = 34"},{name:"attention_head_dim",val:": int = 256"},{name:"num_attention_heads",val:": int = 18"},{name:"intermediate_size",val:": int = 12288"},{name:"adaln_dim",val:": int = 512"},{name:"llm_features_dim",val:": int = 53248"},{name:"rope_theta",val:": int = 5000000"},{name:"mrope_section",val:": tuple = (24, 20, 20)"},{name:"norm_eps",val:": float = 1e-05"}],parametersDescription:[{anchor:"diffusers.Ideogram4Transformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to 128) &#x2014;
Latent channel count after patchification (<code>ae_channels * patch_size ** 2</code>).`,name:"in_channels"},{anchor:"diffusers.Ideogram4Transformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to 34) &#x2014;
Number of transformer blocks.`,name:"num_layers"},{anchor:"diffusers.Ideogram4Transformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to 256) &#x2014;
Dimension of each attention head; the total hidden size is <code>attention_head_dim * num_attention_heads</code>.`,name:"attention_head_dim"},{anchor:"diffusers.Ideogram4Transformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to 18) &#x2014;
Number of attention heads.`,name:"num_attention_heads"},{anchor:"diffusers.Ideogram4Transformer2DModel.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, defaults to 12288) &#x2014;
Feed-forward hidden size used by the SwiGLU MLP inside each block.`,name:"intermediate_size"},{anchor:"diffusers.Ideogram4Transformer2DModel.adaln_dim",description:`<strong>adaln_dim</strong> (<code>int</code>, defaults to 512) &#x2014;
Dimensionality of the conditioning vector consumed by the AdaLN modulations.`,name:"adaln_dim"},{anchor:"diffusers.Ideogram4Transformer2DModel.llm_features_dim",description:`<strong>llm_features_dim</strong> (<code>int</code>, defaults to 53248) &#x2014;
Dimensionality of the per-token text features fed into the model (typically a concatenation of hidden
states from several layers of the text encoder).`,name:"llm_features_dim"},{anchor:"diffusers.Ideogram4Transformer2DModel.rope_theta",description:`<strong>rope_theta</strong> (<code>int</code>, defaults to 5_000_000) &#x2014;
Base used by the multi-axis rotary position embedding.`,name:"rope_theta"},{anchor:"diffusers.Ideogram4Transformer2DModel.mrope_section",description:`<strong>mrope_section</strong> (<code>tuple[int, int, int]</code>, defaults to <code>(24, 20, 20)</code>) &#x2014;
Number of frequencies allocated to each of the (t, h, w) axes of MRoPE.`,name:"mrope_section"},{anchor:"diffusers.Ideogram4Transformer2DModel.norm_eps",description:`<strong>norm_eps</strong> (<code>float</code>, defaults to 1e-5) &#x2014;
Epsilon used by the RMSNorm modules inside the transformer blocks.`,name:"norm_eps"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_ideogram4.py#L273"}}),T=new Z({props:{name:"forward",anchor:"diffusers.Ideogram4Transformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"position_ids",val:": Tensor"},{name:"segment_ids",val:": Tensor"},{name:"indicator",val:": Tensor"},{name:"attention_kwargs",val:": dict | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.Ideogram4Transformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, in_channels)</code>) &#x2014;
Packed sequence of patchified noisy image tokens. Non-image positions are masked out internally.`,name:"hidden_states"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.Tensor</code> of shape <code>(batch_size,)</code> or <code>(batch_size, sequence_length)</code>) &#x2014;
Flow-matching time in <code>[0, 1]</code> (0 is pure noise, 1 is clean data).`,name:"timestep"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, llm_features_dim)</code>) &#x2014;
Per-token text conditioning features. Non-text positions are masked out internally.`,name:"encoder_hidden_states"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, 3)</code>) &#x2014;
<code>(t, h, w)</code> coordinates consumed by the multi-axis RoPE.`,name:"position_ids"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.segment_ids",description:`<strong>segment_ids</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Per-token sample id within a packed batch. Positions sharing a <code>segment_id</code> attend to each other.`,name:"segment_ids"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.indicator",description:`<strong>indicator</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Per-token role: <code>LLM_TOKEN_INDICATOR</code> (text) or <code>OUTPUT_IMAGE_INDICATOR</code> (image).`,name:"indicator"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary passed along to the attention processor. A <code>&quot;scale&quot;</code> entry scales the LoRA weights
(when the PEFT backend is active).`,name:"attention_kwargs"},{anchor:"diffusers.Ideogram4Transformer2DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <a href="/docs/diffusers/pr_13921/en/api/models/consisid_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput">Transformer2DModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_ideogram4.py#L368",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_13921/en/api/models/consisid_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput"
>Transformer2DModelOutput</a> or a <code>tuple</code> whose first element is a tensor of shape
<code>(batch_size, sequence_length, in_channels)</code> in the model’s compute dtype. Only positions tagged with
<code>OUTPUT_IMAGE_INDICATOR</code> carry meaningful velocity predictions.</p>
`}}),b=new ie({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/ideogram4_transformer2d.md"}}),{c(){d=i("meta"),L=r(),P=i("p"),E=r(),M(h.$$.fragment),q=r(),M(p.$$.fragment),C=r(),u=i("p"),u.innerHTML=J,N=r(),M(g.$$.fragment),O=r(),n=i("div"),M(_.$$.fragment),V=r(),x=i("p"),x.textContent=Q,j=r(),$=i("p"),$.innerHTML=X,B=r(),l=i("div"),M(T.$$.fragment),K=r(),v=i("p"),v.textContent=Y,A=r(),M(b.$$.fragment),R=r(),z=i("p"),this.h()},l(e){const t=se("svelte-u9bgzb",document.head);d=m(t,"META",{name:!0,content:!0}),t.forEach(o),L=a(e),P=m(e,"P",{}),U(P).forEach(o),E=a(e),D(h.$$.fragment,e),q=a(e),D(p.$$.fragment,e),C=a(e),u=m(e,"P",{"data-svelte-h":!0}),G(u)!=="svelte-1wccyzl"&&(u.innerHTML=J),N=a(e),D(g.$$.fragment,e),O=a(e),n=m(e,"DIV",{class:!0});var f=U(n);D(_.$$.fragment,f),V=a(f),x=m(f,"P",{"data-svelte-h":!0}),G(x)!=="svelte-kdxio6"&&(x.textContent=Q),j=a(f),$=m(f,"P",{"data-svelte-h":!0}),G($)!=="svelte-k1l7p9"&&($.innerHTML=X),B=a(f),l=m(f,"DIV",{class:!0});var S=U(l);D(T.$$.fragment,S),K=a(S),v=m(S,"P",{"data-svelte-h":!0}),G(v)!=="svelte-gmxmy1"&&(v.textContent=Y),S.forEach(o),f.forEach(o),A=a(e),D(b.$$.fragment,e),R=a(e),z=m(e,"P",{}),U(z).forEach(o),this.h()},h(){F(d,"name","hf:doc:metadata"),F(d,"content",ce),F(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(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,t){c(document.head,d),s(e,L,t),s(e,P,t),s(e,E,t),w(h,e,t),s(e,q,t),w(p,e,t),s(e,C,t),s(e,u,t),s(e,N,t),w(g,e,t),s(e,O,t),s(e,n,t),w(_,n,null),c(n,V),c(n,x),c(n,j),c(n,$),c(n,B),c(n,l),w(T,l,null),c(l,K),c(l,v),s(e,A,t),w(b,e,t),s(e,R,t),s(e,z,t),H=!0},p:oe,i(e){H||(y(h.$$.fragment,e),y(p.$$.fragment,e),y(g.$$.fragment,e),y(_.$$.fragment,e),y(T.$$.fragment,e),y(b.$$.fragment,e),H=!0)},o(e){I(h.$$.fragment,e),I(p.$$.fragment,e),I(g.$$.fragment,e),I(_.$$.fragment,e),I(T.$$.fragment,e),I(b.$$.fragment,e),H=!1},d(e){e&&(o(L),o(P),o(E),o(q),o(C),o(u),o(N),o(O),o(n),o(A),o(R),o(z)),o(d),k(h,e),k(p,e),k(g,e),k(_),k(T),k(b,e)}}}const ce='{"title":"Ideogram4Transformer2DModel","local":"ideogram4transformer2dmodel","sections":[{"title":"Ideogram4Transformer2DModel","local":"diffusers.Ideogram4Transformer2DModel","sections":[],"depth":2}],"depth":1}';function le(W){return ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _e extends re{constructor(d){super(),ae(this,d,le,me,te,{})}}export{_e as component};

Xet Storage Details

Size:
11.1 kB
·
Xet hash:
bc54ad8dd017bcee2371098239adbd1c9e821bf1ff2d9ebb8991861ba924a866

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.