Buckets:

download
raw
11.7 kB
import{s as F,n as J,o as Q}from"../chunks/scheduler.53228c21.js";import{S as Y,i as Z,e as u,s as r,c as b,h as ee,a as h,d as t,b as s,f as S,g as v,j as B,k as q,l as G,m as n,n as x,t as $,o as D,p as M}from"../chunks/index.cac5d66a.js";import{C as oe}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as R}from"../chunks/Docstring.9de32ff4.js";import{H as X,E as te}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function ne(W){let a,k,I,y,m,z,c,C,l,K="A Diffusion Transformer model for 2D data from [GlmImageTransformer2DModel] (TODO).",P,f,L,d,g,V,i,p,j,T,U='The <a href="/docs/diffusers/pr_13921/en/api/models/glm_image_transformer2d#diffusers.GlmImageTransformer2DModel">GlmImageTransformer2DModel</a> forward method.',E,_,N,w,A;return m=new oe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),c=new X({props:{title:"GlmImageTransformer2DModel",local:"glmimagetransformer2dmodel",headingTag:"h1"}}),f=new X({props:{title:"GlmImageTransformer2DModel",local:"diffusers.GlmImageTransformer2DModel",headingTag:"h2"}}),g=new R({props:{name:"class diffusers.GlmImageTransformer2DModel",anchor:"diffusers.GlmImageTransformer2DModel",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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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 =&gt; 128 * 8 * 2 =&gt; 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>) &#x2014;
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 =&gt; 128 * 8 =&gt; 1024</code>`,name:"sample_size"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_glm_image.py#L503"}}),p=new R({props:{name:"forward",anchor:"diffusers.GlmImageTransformer2DModel.forward",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:": torch.Tensor | None = 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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.target_size",description:`<strong>target_size</strong> (<code>torch.Tensor</code>) &#x2014;
Target image size conditioning.`,name:"target_size"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.crop_coords",description:`<strong>crop_coords</strong> (<code>torch.Tensor</code>) &#x2014;
Crop coordinates conditioning.`,name:"crop_coords"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.attention_kwargs",description:`<strong>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:"attention_kwargs"},{anchor:"diffusers.GlmImageTransformer2DModel.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"},{anchor:"diffusers.GlmImageTransformer2DModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
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>) &#x2014;
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>) &#x2014;
Pre-computed rotary positional embeddings.`,name:"image_rotary_emb"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_glm_image.py#L597",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>
`}}),_=new te({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/glm_image_transformer2d.md"}}),{c(){a=u("meta"),k=r(),I=u("p"),y=r(),b(m.$$.fragment),z=r(),b(c.$$.fragment),C=r(),l=u("p"),l.textContent=K,P=r(),b(f.$$.fragment),L=r(),d=u("div"),b(g.$$.fragment),V=r(),i=u("div"),b(p.$$.fragment),j=r(),T=u("p"),T.innerHTML=U,E=r(),b(_.$$.fragment),N=r(),w=u("p"),this.h()},l(e){const o=ee("svelte-u9bgzb",document.head);a=h(o,"META",{name:!0,content:!0}),o.forEach(t),k=s(e),I=h(e,"P",{}),S(I).forEach(t),y=s(e),v(m.$$.fragment,e),z=s(e),v(c.$$.fragment,e),C=s(e),l=h(e,"P",{"data-svelte-h":!0}),B(l)!=="svelte-f8vs2r"&&(l.textContent=K),P=s(e),v(f.$$.fragment,e),L=s(e),d=h(e,"DIV",{class:!0});var H=S(d);v(g.$$.fragment,H),V=s(H),i=h(H,"DIV",{class:!0});var O=S(i);v(p.$$.fragment,O),j=s(O),T=h(O,"P",{"data-svelte-h":!0}),B(T)!=="svelte-owgjj3"&&(T.innerHTML=U),O.forEach(t),H.forEach(t),E=s(e),v(_.$$.fragment,e),N=s(e),w=h(e,"P",{}),S(w).forEach(t),this.h()},h(){q(a,"name","hf:doc:metadata"),q(a,"content",re),q(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(d,"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,o){G(document.head,a),n(e,k,o),n(e,I,o),n(e,y,o),x(m,e,o),n(e,z,o),x(c,e,o),n(e,C,o),n(e,l,o),n(e,P,o),x(f,e,o),n(e,L,o),n(e,d,o),x(g,d,null),G(d,V),G(d,i),x(p,i,null),G(i,j),G(i,T),n(e,E,o),x(_,e,o),n(e,N,o),n(e,w,o),A=!0},p:J,i(e){A||($(m.$$.fragment,e),$(c.$$.fragment,e),$(f.$$.fragment,e),$(g.$$.fragment,e),$(p.$$.fragment,e),$(_.$$.fragment,e),A=!0)},o(e){D(m.$$.fragment,e),D(c.$$.fragment,e),D(f.$$.fragment,e),D(g.$$.fragment,e),D(p.$$.fragment,e),D(_.$$.fragment,e),A=!1},d(e){e&&(t(k),t(I),t(y),t(z),t(C),t(l),t(P),t(L),t(d),t(E),t(N),t(w)),t(a),M(m,e),M(c,e),M(f,e),M(g),M(p),M(_,e)}}}const re='{"title":"GlmImageTransformer2DModel","local":"glmimagetransformer2dmodel","sections":[{"title":"GlmImageTransformer2DModel","local":"diffusers.GlmImageTransformer2DModel","sections":[],"depth":2}],"depth":1}';function se(W){return Q(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class le extends Y{constructor(a){super(),Z(this,a,se,ne,F,{})}}export{le as component};

Xet Storage Details

Size:
11.7 kB
·
Xet hash:
131b0777fe8e8c5213b0698cf902f117acb4711857820a704f724f98f8ada16d

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