Buckets:

download
raw
9.19 kB
import"../chunks/DsnmJJEf.js";import{i as D,h as M,C as x,H as m,D as l,E as I,s as y}from"../chunks/BtE7mKSK.js";import{p as w,o as k,s as e,f as z,a as f,b as P,c as h,d as u,n as g,r as p}from"../chunks/jDjavuwI.js";const q='{"title":"Ideogram4Transformer2DModel","local":"ideogram4transformer2dmodel","sections":[{"title":"Ideogram4Transformer2DModel","local":"diffusers.Ideogram4Transformer2DModel","sections":[],"depth":2}],"depth":1}';var N=u('<meta name="hf:doc:metadata"/>'),L=u(`<p></p> <!> <!> <p>A transformer for image-like data from <a href="https://github.com/ideogram-oss/ideogram-4" rel="nofollow">Ideogram 4</a>.</p> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The flow-matching transformer backbone used by the Ideogram 4 pipeline.</p> <p>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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Predict the flow-matching velocity for the image-token positions of the packed sequence.</p></div></div> <!> <p></p>`,1);function R(_,T){w(T,!1),k(()=>{new URLSearchParams(window.location.search).get("fw")}),D();var n=L();M("14h36f1",i=>{var c=N();y(c,"content",q),f(i,c)});var t=e(z(n),2);x(t,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var r=e(t,2);m(r,{title:"Ideogram4Transformer2DModel",local:"ideogram4transformer2dmodel",headingTag:"h1"});var a=e(r,4);m(a,{title:"Ideogram4Transformer2DModel",local:"diffusers.Ideogram4Transformer2DModel",headingTag:"h2"});var o=e(a,2),s=h(o);l(s,{name:"class diffusers.Ideogram4Transformer2DModel",anchor:"diffusers.Ideogram4Transformer2DModel",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/models/transformers/transformer_ideogram4.py#L278",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"}]});var d=e(s,6),b=h(d);l(b,{name:"forward",anchor:"diffusers.Ideogram4Transformer2DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/models/transformers/transformer_ideogram4.py#L373",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_13881/en/api/models/sana_video_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput">Transformer2DModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_13881/en/api/models/sana_video_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>
`}),g(2),p(d),p(o);var v=e(o,2);I(v,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/ideogram4_transformer2d.md"}),g(2),f(_,n),P()}export{R as component};

Xet Storage Details

Size:
9.19 kB
·
Xet hash:
a5e7f1013f574508104be60320fb437d7afa2cfe713c8c109340b6d86933be8a

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