Buckets:
| import"../chunks/DsnmJJEf.js";import{i as x,h as D,C as I,H as c,D as l,E as M,s as G}from"../chunks/BtE7mKSK.js";import{p as w,o as k,s as e,f as y,a as f,b as z,c as g,d as p,n as h,r as _}from"../chunks/jDjavuwI.js";const L='{"title":"GlmImageTransformer2DModel","local":"glmimagetransformer2dmodel","sections":[{"title":"GlmImageTransformer2DModel","local":"diffusers.GlmImageTransformer2DModel","sections":[],"depth":2}],"depth":1}';var N=p('<meta name="hf:doc:metadata"/>'),O=p('<p></p> <!> <!> <p>A Diffusion Transformer model for 2D data from [GlmImageTransformer2DModel] (TODO).</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"><!> <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 <a href="/docs/diffusers/pr_14409/en/api/models/glm_image_transformer2d#diffusers.GlmImageTransformer2DModel">GlmImageTransformer2DModel</a> forward method.</p></div></div> <!> <p></p>',1);function H(u,T){w(T,!1),k(()=>{new URLSearchParams(window.location.search).get("fw")}),x();var r=O();D("jgwxy7",i=>{var m=N();G(m,"content",L),f(i,m)});var n=e(y(r),2);I(n,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var t=e(n,2);c(t,{title:"GlmImageTransformer2DModel",local:"glmimagetransformer2dmodel",headingTag:"h1"});var s=e(t,4);c(s,{title:"GlmImageTransformer2DModel",local:"diffusers.GlmImageTransformer2DModel",headingTag:"h2"});var o=e(s,2),a=g(o);l(a,{name:"class diffusers.GlmImageTransformer2DModel",anchor:"diffusers.GlmImageTransformer2DModel",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/transformers/transformer_glm_image.py#L503",parameters:[{name:"patch_size",val:": int = 2"},{name:"in_channels",val:": int = 16"},{name:"out_channels",val:": int = 16"},{name:"num_layers",val:": int = 30"},{name:"attention_head_dim",val:": int = 40"},{name:"num_attention_heads",val:": int = 64"},{name:"text_embed_dim",val:": int = 1472"},{name:"time_embed_dim",val:": int = 512"},{name:"condition_dim",val:": int = 256"},{name:"prior_vq_quantizer_codebook_size",val:": int = 16384"}],parametersDescription:[{anchor:"diffusers.GlmImageTransformer2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| The size of the patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.GlmImageTransformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.GlmImageTransformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>30</code>) — | |
| The number of layers of Transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.GlmImageTransformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>40</code>) — | |
| The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.GlmImageTransformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>64</code>) — | |
| The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.GlmImageTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.GlmImageTransformer2DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>1472</code>) — | |
| Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.GlmImageTransformer2DModel.time_embed_dim",description:`<strong>time_embed_dim</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| Output dimension of timestep embeddings.`,name:"time_embed_dim"},{anchor:"diffusers.GlmImageTransformer2DModel.condition_dim",description:`<strong>condition_dim</strong> (<code>int</code>, defaults to <code>256</code>) — | |
| The embedding dimension of the input SDXL-style resolution conditions (original_size, target_size, | |
| crop_coords).`,name:"condition_dim"},{anchor:"diffusers.GlmImageTransformer2DModel.pos_embed_max_size",description:`<strong>pos_embed_max_size</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The maximum resolution of the positional embeddings, from which slices of shape <code>H x W</code> are taken and added | |
| to input patched latents, where <code>H</code> and <code>W</code> are the latent height and width respectively. A value of 128 | |
| means that the maximum supported height and width for image generation is <code>128 * vae_scale_factor * patch_size => 128 * 8 * 2 => 2048</code>.`,name:"pos_embed_max_size"},{anchor:"diffusers.GlmImageTransformer2DModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The base resolution of input latents. If height/width is not provided during generation, this value is used | |
| to determine the resolution as <code>sample_size * vae_scale_factor => 128 * 8 => 1024</code>`,name:"sample_size"}]});var d=e(a,2),b=g(d);l(b,{name:"forward",anchor:"diffusers.GlmImageTransformer2DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14409/src/diffusers/models/transformers/transformer_glm_image.py#L597",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"prior_token_id",val:": Tensor"},{name:"prior_token_drop",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"target_size",val:": Tensor"},{name:"crop_coords",val:": Tensor"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"kv_caches",val:": diffusers.models.transformers.transformer_glm_image.GlmImageKVCache | None = None"},{name:"image_rotary_emb",val:": tuple[torch.Tensor, torch.Tensor] | list[tuple[torch.Tensor, torch.Tensor]] | None = None"}],parametersDescription:[{anchor:"diffusers.GlmImageTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, in_channels, height, width)</code>) — | |
| Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_len, embed_dims)</code>) — | |
| Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.prior_token_id",description:`<strong>prior_token_id</strong> (<code>torch.Tensor</code>) — | |
| Token ids for the prior embedding lookup.`,name:"prior_token_id"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.prior_token_drop",description:`<strong>prior_token_drop</strong> (<code>torch.Tensor</code>) — | |
| Boolean mask indicating which prior embeddings should be dropped (zeroed out).`,name:"prior_token_drop"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) — | |
| Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.target_size",description:`<strong>target_size</strong> (<code>torch.Tensor</code>) — | |
| Target image size conditioning.`,name:"target_size"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.crop_coords",description:`<strong>crop_coords</strong> (<code>torch.Tensor</code>) — | |
| Crop coordinates conditioning.`,name:"crop_coords"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<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.GlmImageTransformer2DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain | |
| tuple.`,name:"return_dict"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Mask applied to attention scores.`,name:"attention_mask"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.kv_caches",description:`<strong>kv_caches</strong> (<code>GlmImageKVCache</code>, <em>optional</em>) — | |
| Pre-computed key/value caches used to speed up inference.`,name:"kv_caches"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.image_rotary_emb",description:`<strong>image_rotary_emb</strong> (<code>tuple</code> of <code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-computed rotary positional embeddings.`,name:"image_rotary_emb"}],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> | |
| `}),h(2),_(d),_(o);var v=e(o,2);M(v,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/glm_image_transformer2d.md"}),h(2),f(u,r),z()}export{H as component}; | |
Xet Storage Details
- Size:
- 10 kB
- Xet hash:
- b7773780236789333f9694a8e83f73b11355558d703d02cae54fa76f00bc5b7f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.