Buckets:
| import{s as ee,n as te,o as oe}from"../chunks/scheduler.8c3d61f6.js";import{S as ne,i as se,g as d,s,r as $,A as re,h as m,f as o,c as r,j as P,u as M,x as L,k as q,y as N,a as n,v as w,d as v,t as y,w as D}from"../chunks/index.da70eac4.js";import{D as K}from"../chunks/Docstring.9419aa1d.js";import{C as ie}from"../chunks/CodeBlock.a9c4becf.js";import{H as Y,E as ae}from"../chunks/getInferenceSnippets.39110341.js";function de(X){let i,z,C,Z,l,J,f,S='A Diffusion Transformer model for 2D data from <a href="">CogView4</a>',k,c,A="The model can be loaded with the following code snippet.",H,u,R,p,E,h,_,U,g,W,a,b,B,x,Q='The output of <a href="/docs/diffusers/pr_11340/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',I,T,j,V,G;return l=new Y({props:{title:"CogView4Transformer2DModel",local:"cogview4transformer2dmodel",headingTag:"h1"}}),u=new ie({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvZ1ZpZXc0VHJhbnNmb3JtZXIyRE1vZGVsJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBDb2dWaWV3NFRyYW5zZm9ybWVyMkRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyVEhVRE0lMkZDb2dWaWV3NC02QiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNikudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CogView4Transformer2DModel | |
| transformer = CogView4Transformer2DModel.from_pretrained(<span class="hljs-string">"THUDM/CogView4-6B"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.bfloat16).to(<span class="hljs-string">"cuda"</span>)`,wrap:!1}}),p=new Y({props:{title:"CogView4Transformer2DModel",local:"diffusers.CogView4Transformer2DModel",headingTag:"h2"}}),_=new K({props:{name:"class diffusers.CogView4Transformer2DModel",anchor:"diffusers.CogView4Transformer2DModel",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 = 4096"},{name:"time_embed_dim",val:": int = 512"},{name:"condition_dim",val:": int = 256"},{name:"pos_embed_max_size",val:": int = 128"},{name:"sample_size",val:": int = 128"},{name:"rope_axes_dim",val:": typing.Tuple[int, int] = (256, 256)"}],parametersDescription:[{anchor:"diffusers.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) — | |
| Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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.CogView4Transformer2DModel.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"}],source:"https://github.com/huggingface/diffusers/blob/vr_11340/src/diffusers/models/transformers/transformer_cogview4.py#L585"}}),g=new Y({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),b=new K({props:{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",parameters:[{name:"sample",val:": torch.Tensor"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>(batch size, num_vector_embeds - 1, num_latent_pixels)</code> if <a href="/docs/diffusers/pr_11340/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) — | |
| The hidden states output conditioned on the <code>encoder_hidden_states</code> input. If discrete, returns probability | |
| distributions for the unnoised latent pixels.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_11340/src/diffusers/models/modeling_outputs.py#L20"}}),T=new ae({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/cogview4_transformer2d.md"}}),{c(){i=d("meta"),z=s(),C=d("p"),Z=s(),$(l.$$.fragment),J=s(),f=d("p"),f.innerHTML=S,k=s(),c=d("p"),c.textContent=A,H=s(),$(u.$$.fragment),R=s(),$(p.$$.fragment),E=s(),h=d("div"),$(_.$$.fragment),U=s(),$(g.$$.fragment),W=s(),a=d("div"),$(b.$$.fragment),B=s(),x=d("p"),x.innerHTML=Q,I=s(),$(T.$$.fragment),j=s(),V=d("p"),this.h()},l(e){const t=re("svelte-u9bgzb",document.head);i=m(t,"META",{name:!0,content:!0}),t.forEach(o),z=r(e),C=m(e,"P",{}),P(C).forEach(o),Z=r(e),M(l.$$.fragment,e),J=r(e),f=m(e,"P",{"data-svelte-h":!0}),L(f)!=="svelte-1qocnal"&&(f.innerHTML=S),k=r(e),c=m(e,"P",{"data-svelte-h":!0}),L(c)!=="svelte-1vuni30"&&(c.textContent=A),H=r(e),M(u.$$.fragment,e),R=r(e),M(p.$$.fragment,e),E=r(e),h=m(e,"DIV",{class:!0});var F=P(h);M(_.$$.fragment,F),F.forEach(o),U=r(e),M(g.$$.fragment,e),W=r(e),a=m(e,"DIV",{class:!0});var O=P(a);M(b.$$.fragment,O),B=r(O),x=m(O,"P",{"data-svelte-h":!0}),L(x)!=="svelte-1ikuc4r"&&(x.innerHTML=Q),O.forEach(o),I=r(e),M(T.$$.fragment,e),j=r(e),V=m(e,"P",{}),P(V).forEach(o),this.h()},h(){q(i,"name","hf:doc:metadata"),q(i,"content",me),q(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(a,"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){N(document.head,i),n(e,z,t),n(e,C,t),n(e,Z,t),w(l,e,t),n(e,J,t),n(e,f,t),n(e,k,t),n(e,c,t),n(e,H,t),w(u,e,t),n(e,R,t),w(p,e,t),n(e,E,t),n(e,h,t),w(_,h,null),n(e,U,t),w(g,e,t),n(e,W,t),n(e,a,t),w(b,a,null),N(a,B),N(a,x),n(e,I,t),w(T,e,t),n(e,j,t),n(e,V,t),G=!0},p:te,i(e){G||(v(l.$$.fragment,e),v(u.$$.fragment,e),v(p.$$.fragment,e),v(_.$$.fragment,e),v(g.$$.fragment,e),v(b.$$.fragment,e),v(T.$$.fragment,e),G=!0)},o(e){y(l.$$.fragment,e),y(u.$$.fragment,e),y(p.$$.fragment,e),y(_.$$.fragment,e),y(g.$$.fragment,e),y(b.$$.fragment,e),y(T.$$.fragment,e),G=!1},d(e){e&&(o(z),o(C),o(Z),o(J),o(f),o(k),o(c),o(H),o(R),o(E),o(h),o(U),o(W),o(a),o(I),o(j),o(V)),o(i),D(l,e),D(u,e),D(p,e),D(_),D(g,e),D(b),D(T,e)}}}const me='{"title":"CogView4Transformer2DModel","local":"cogview4transformer2dmodel","sections":[{"title":"CogView4Transformer2DModel","local":"diffusers.CogView4Transformer2DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function le(X){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _e extends ne{constructor(i){super(),se(this,i,le,de,ee,{})}}export{_e as component}; | |
Xet Storage Details
- Size:
- 9.42 kB
- Xet hash:
- 6ec9d2836d8291a714b9c63297ecb39e842f6702d57e22aca2a7bde83969134c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.