Buckets:

rtrm's picture
download
raw
11.7 kB
import{s as ae,n as se,o as de}from"../chunks/scheduler.53228c21.js";import{S as ie,i as me,e as m,s as r,c as u,h as le,a as l,d as t,b as a,f as O,g as f,j as G,k as F,l as E,m as o,n as c,t as p,o as h,p as g}from"../chunks/index.100fac89.js";import{C as ue}from"../chunks/CopyLLMTxtMenu.67e413d2.js";import{D as re}from"../chunks/Docstring.60584164.js";import{C as fe}from"../chunks/CodeBlock.d30a6509.js";import{H as A,E as ce}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.debde53c.js";function pe(K){let s,J,k,W,_,Z,y,j,T,ee='A Diffusion Transformer model for <a href="https://github.com/Tencent-Hunyuan/HunyuanImage-2.1" rel="nofollow">HunyuanImage2.1</a>.',C,b,ne="The model can be loaded with the following code snippet.",L,$,V,M,P,d,x,Q,I,te='The Transformer model used in <a href="https://github.com/Tencent-Hunyuan/HunyuanImage-2.1" rel="nofollow">HunyuanImage-2.1</a>.',R,H,q,i,v,B,w,oe='The output of <a href="/docs/diffusers/pr_13331/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',N,D,X,z,S;return _=new ue({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new A({props:{title:"HunyuanImageTransformer2DModel",local:"hunyuanimagetransformer2dmodel",headingTag:"h1"}}),$=new fe({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEh1bnl1YW5JbWFnZVRyYW5zZm9ybWVyMkRNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwSHVueXVhbkltYWdlVHJhbnNmb3JtZXIyRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJodW55dWFudmlkZW8tY29tbXVuaXR5JTJGSHVueXVhbkltYWdlLTIuMS1EaWZmdXNlcnMlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ0cmFuc2Zvcm1lciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> HunyuanImageTransformer2DModel
transformer = HunyuanImageTransformer2DModel.from_pretrained(<span class="hljs-string">&quot;hunyuanvideo-community/HunyuanImage-2.1-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),M=new A({props:{title:"HunyuanImageTransformer2DModel",local:"diffusers.HunyuanImageTransformer2DModel",headingTag:"h2"}}),x=new re({props:{name:"class diffusers.HunyuanImageTransformer2DModel",anchor:"diffusers.HunyuanImageTransformer2DModel",parameters:[{name:"in_channels",val:": int = 64"},{name:"out_channels",val:": int = 64"},{name:"num_attention_heads",val:": int = 28"},{name:"attention_head_dim",val:": int = 128"},{name:"num_layers",val:": int = 20"},{name:"num_single_layers",val:": int = 40"},{name:"num_refiner_layers",val:": int = 2"},{name:"mlp_ratio",val:": float = 4.0"},{name:"patch_size",val:": tuple = (1, 1)"},{name:"qk_norm",val:": str = 'rms_norm'"},{name:"guidance_embeds",val:": bool = False"},{name:"text_embed_dim",val:": int = 3584"},{name:"text_embed_2_dim",val:": int | None = None"},{name:"rope_theta",val:": float = 256.0"},{name:"rope_axes_dim",val:": tuple = (64, 64)"},{name:"use_meanflow",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.HunyuanImageTransformer2DModel.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.HunyuanImageTransformer2DModel.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.HunyuanImageTransformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) &#x2014;
The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.HunyuanImageTransformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.HunyuanImageTransformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>20</code>) &#x2014;
The number of layers of dual-stream blocks to use.`,name:"num_layers"},{anchor:"diffusers.HunyuanImageTransformer2DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>40</code>) &#x2014;
The number of layers of single-stream blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.HunyuanImageTransformer2DModel.num_refiner_layers",description:`<strong>num_refiner_layers</strong> (<code>int</code>, defaults to <code>2</code>) &#x2014;
The number of layers of refiner blocks to use.`,name:"num_refiner_layers"},{anchor:"diffusers.HunyuanImageTransformer2DModel.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, defaults to <code>4.0</code>) &#x2014;
The ratio of the hidden layer size to the input size in the feedforward network.`,name:"mlp_ratio"},{anchor:"diffusers.HunyuanImageTransformer2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) &#x2014;
The size of the spatial patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.HunyuanImageTransformer2DModel.patch_size_t",description:`<strong>patch_size_t</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
The size of the tmeporal patches to use in the patch embedding layer.`,name:"patch_size_t"},{anchor:"diffusers.HunyuanImageTransformer2DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, defaults to <code>rms_norm</code>) &#x2014;
The normalization to use for the query and key projections in the attention layers.`,name:"qk_norm"},{anchor:"diffusers.HunyuanImageTransformer2DModel.guidance_embeds",description:`<strong>guidance_embeds</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to use guidance embeddings in the model.`,name:"guidance_embeds"},{anchor:"diffusers.HunyuanImageTransformer2DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.HunyuanImageTransformer2DModel.pooled_projection_dim",description:`<strong>pooled_projection_dim</strong> (<code>int</code>, defaults to <code>768</code>) &#x2014;
The dimension of the pooled projection of the text embeddings.`,name:"pooled_projection_dim"},{anchor:"diffusers.HunyuanImageTransformer2DModel.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, defaults to <code>256.0</code>) &#x2014;
The value of theta to use in the RoPE layer.`,name:"rope_theta"},{anchor:"diffusers.HunyuanImageTransformer2DModel.rope_axes_dim",description:`<strong>rope_axes_dim</strong> (<code>tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) &#x2014;
The dimensions of the axes to use in the RoPE layer.`,name:"rope_axes_dim"},{anchor:"diffusers.HunyuanImageTransformer2DModel.image_condition_type",description:`<strong>image_condition_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The type of image conditioning to use. If <code>None</code>, no image conditioning is used. If <code>latent_concat</code>, the
image is concatenated to the latent stream. If <code>token_replace</code>, the image is used to replace first-frame
tokens in the latent stream and apply conditioning.`,name:"image_condition_type"}],source:"https://github.com/huggingface/diffusers/blob/vr_13331/src/diffusers/models/transformers/transformer_hunyuanimage.py#L617"}}),H=new A({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),v=new re({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_13331/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) &#x2014;
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_13331/src/diffusers/models/modeling_outputs.py#L21"}}),D=new ce({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/hunyuanimage_transformer_2d.md"}}),{c(){s=m("meta"),J=r(),k=m("p"),W=r(),u(_.$$.fragment),Z=r(),u(y.$$.fragment),j=r(),T=m("p"),T.innerHTML=ee,C=r(),b=m("p"),b.textContent=ne,L=r(),u($.$$.fragment),V=r(),u(M.$$.fragment),P=r(),d=m("div"),u(x.$$.fragment),Q=r(),I=m("p"),I.innerHTML=te,R=r(),u(H.$$.fragment),q=r(),i=m("div"),u(v.$$.fragment),B=r(),w=m("p"),w.innerHTML=oe,N=r(),u(D.$$.fragment),X=r(),z=m("p"),this.h()},l(e){const n=le("svelte-u9bgzb",document.head);s=l(n,"META",{name:!0,content:!0}),n.forEach(t),J=a(e),k=l(e,"P",{}),O(k).forEach(t),W=a(e),f(_.$$.fragment,e),Z=a(e),f(y.$$.fragment,e),j=a(e),T=l(e,"P",{"data-svelte-h":!0}),G(T)!=="svelte-a51oc8"&&(T.innerHTML=ee),C=a(e),b=l(e,"P",{"data-svelte-h":!0}),G(b)!=="svelte-1vuni30"&&(b.textContent=ne),L=a(e),f($.$$.fragment,e),V=a(e),f(M.$$.fragment,e),P=a(e),d=l(e,"DIV",{class:!0});var U=O(d);f(x.$$.fragment,U),Q=a(U),I=l(U,"P",{"data-svelte-h":!0}),G(I)!=="svelte-1e43fo9"&&(I.innerHTML=te),U.forEach(t),R=a(e),f(H.$$.fragment,e),q=a(e),i=l(e,"DIV",{class:!0});var Y=O(i);f(v.$$.fragment,Y),B=a(Y),w=l(Y,"P",{"data-svelte-h":!0}),G(w)!=="svelte-1460eox"&&(w.innerHTML=oe),Y.forEach(t),N=a(e),f(D.$$.fragment,e),X=a(e),z=l(e,"P",{}),O(z).forEach(t),this.h()},h(){F(s,"name","hf:doc:metadata"),F(s,"content",he),F(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(i,"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,n){E(document.head,s),o(e,J,n),o(e,k,n),o(e,W,n),c(_,e,n),o(e,Z,n),c(y,e,n),o(e,j,n),o(e,T,n),o(e,C,n),o(e,b,n),o(e,L,n),c($,e,n),o(e,V,n),c(M,e,n),o(e,P,n),o(e,d,n),c(x,d,null),E(d,Q),E(d,I),o(e,R,n),c(H,e,n),o(e,q,n),o(e,i,n),c(v,i,null),E(i,B),E(i,w),o(e,N,n),c(D,e,n),o(e,X,n),o(e,z,n),S=!0},p:se,i(e){S||(p(_.$$.fragment,e),p(y.$$.fragment,e),p($.$$.fragment,e),p(M.$$.fragment,e),p(x.$$.fragment,e),p(H.$$.fragment,e),p(v.$$.fragment,e),p(D.$$.fragment,e),S=!0)},o(e){h(_.$$.fragment,e),h(y.$$.fragment,e),h($.$$.fragment,e),h(M.$$.fragment,e),h(x.$$.fragment,e),h(H.$$.fragment,e),h(v.$$.fragment,e),h(D.$$.fragment,e),S=!1},d(e){e&&(t(J),t(k),t(W),t(Z),t(j),t(T),t(C),t(b),t(L),t(V),t(P),t(d),t(R),t(q),t(i),t(N),t(X),t(z)),t(s),g(_,e),g(y,e),g($,e),g(M,e),g(x),g(H,e),g(v),g(D,e)}}}const he='{"title":"HunyuanImageTransformer2DModel","local":"hunyuanimagetransformer2dmodel","sections":[{"title":"HunyuanImageTransformer2DModel","local":"diffusers.HunyuanImageTransformer2DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function ge(K){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends ie{constructor(s){super(),me(this,s,ge,pe,ae,{})}}export{xe as component};

Xet Storage Details

Size:
11.7 kB
·
Xet hash:
6ab2cdac568fb565b5fcd5d6c6b96de1693d88676a1bfffad20568a4e3710626

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