Buckets:
| import{s as ae,n as re,o as ie}from"../chunks/scheduler.53228c21.js";import{S as de,i as le,e as l,s,c as m,h as ce,a as c,d as o,b as a,f as S,g as f,j as B,k as U,l as w,m as n,n as u,t as p,o as h,p as _}from"../chunks/index.100fac89.js";import{C as me}from"../chunks/CopyLLMTxtMenu.733ee6d3.js";import{D as se}from"../chunks/Docstring.695f69dc.js";import{C as fe}from"../chunks/CodeBlock.d30a6509.js";import{H as Y,E as ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.0e2208d5.js";function pe(Q){let r,k,C,q,g,J,T,z,D,ee='A Diffusion Transformer model for 3D data from <a href="https://github.com/PKU-YuanGroup/ConsisID" rel="nofollow">ConsisID</a> was introduced in <a href="https://huggingface.co/papers/2411.17440" rel="nofollow">Identity-Preserving Text-to-Video Generation by Frequency Decomposition</a> by Peking University & University of Rochester & etc.',j,b,te="The model can be loaded with the following code snippet.",Z,v,P,x,H,i,y,X,I,oe='A Transformer model for video-like data in <a href="https://github.com/PKU-YuanGroup/ConsisID" rel="nofollow">ConsisID</a>.',R,M,V,d,E,K,F,ne='The output of <a href="/docs/diffusers/pr_12849/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',W,L,A,$,N;return g=new me({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new Y({props:{title:"ConsisIDTransformer3DModel",local:"consisidtransformer3dmodel",headingTag:"h1"}}),v=new fe({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvbnNpc0lEVHJhbnNmb3JtZXIzRE1vZGVsJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBDb25zaXNJRFRyYW5zZm9ybWVyM0RNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyQmVzdFdpc2hZc2glMkZDb25zaXNJRC1wcmV2aWV3JTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ConsisIDTransformer3DModel | |
| transformer = ConsisIDTransformer3DModel.from_pretrained(<span class="hljs-string">"BestWishYsh/ConsisID-preview"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.bfloat16).to(<span class="hljs-string">"cuda"</span>)`,wrap:!1}}),x=new Y({props:{title:"ConsisIDTransformer3DModel",local:"diffusers.ConsisIDTransformer3DModel",headingTag:"h2"}}),y=new se({props:{name:"class diffusers.ConsisIDTransformer3DModel",anchor:"diffusers.ConsisIDTransformer3DModel",parameters:[{name:"num_attention_heads",val:": int = 30"},{name:"attention_head_dim",val:": int = 64"},{name:"in_channels",val:": int = 16"},{name:"out_channels",val:": typing.Optional[int] = 16"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"time_embed_dim",val:": int = 512"},{name:"text_embed_dim",val:": int = 4096"},{name:"num_layers",val:": int = 30"},{name:"dropout",val:": float = 0.0"},{name:"attention_bias",val:": bool = True"},{name:"sample_width",val:": int = 90"},{name:"sample_height",val:": int = 60"},{name:"sample_frames",val:": int = 49"},{name:"patch_size",val:": int = 2"},{name:"temporal_compression_ratio",val:": int = 4"},{name:"max_text_seq_length",val:": int = 226"},{name:"activation_fn",val:": str = 'gelu-approximate'"},{name:"timestep_activation_fn",val:": str = 'silu'"},{name:"norm_elementwise_affine",val:": bool = True"},{name:"norm_eps",val:": float = 1e-05"},{name:"spatial_interpolation_scale",val:": float = 1.875"},{name:"temporal_interpolation_scale",val:": float = 1.0"},{name:"use_rotary_positional_embeddings",val:": bool = False"},{name:"use_learned_positional_embeddings",val:": bool = False"},{name:"is_train_face",val:": bool = False"},{name:"is_kps",val:": bool = False"},{name:"cross_attn_interval",val:": int = 2"},{name:"cross_attn_dim_head",val:": int = 128"},{name:"cross_attn_num_heads",val:": int = 16"},{name:"LFE_id_dim",val:": int = 1280"},{name:"LFE_vit_dim",val:": int = 1024"},{name:"LFE_depth",val:": int = 10"},{name:"LFE_dim_head",val:": int = 64"},{name:"LFE_num_heads",val:": int = 16"},{name:"LFE_num_id_token",val:": int = 5"},{name:"LFE_num_querie",val:": int = 32"},{name:"LFE_output_dim",val:": int = 2048"},{name:"LFE_ff_mult",val:": int = 4"},{name:"LFE_num_scale",val:": int = 5"},{name:"local_face_scale",val:": float = 1.0"}],parametersDescription:[{anchor:"diffusers.ConsisIDTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>30</code>) — | |
| The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.ConsisIDTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>64</code>) — | |
| The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.ConsisIDTransformer3DModel.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.ConsisIDTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16</code>) — | |
| The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.ConsisIDTransformer3DModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.ConsisIDTransformer3DModel.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.ConsisIDTransformer3DModel.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.ConsisIDTransformer3DModel.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.ConsisIDTransformer3DModel.dropout",description:`<strong>dropout</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The dropout probability to use.`,name:"dropout"},{anchor:"diffusers.ConsisIDTransformer3DModel.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to use bias in the attention projection layers.`,name:"attention_bias"},{anchor:"diffusers.ConsisIDTransformer3DModel.sample_width",description:`<strong>sample_width</strong> (<code>int</code>, defaults to <code>90</code>) — | |
| The width of the input latents.`,name:"sample_width"},{anchor:"diffusers.ConsisIDTransformer3DModel.sample_height",description:`<strong>sample_height</strong> (<code>int</code>, defaults to <code>60</code>) — | |
| The height of the input latents.`,name:"sample_height"},{anchor:"diffusers.ConsisIDTransformer3DModel.sample_frames",description:`<strong>sample_frames</strong> (<code>int</code>, defaults to <code>49</code>) — | |
| The number of frames in the input latents. Note that this parameter was incorrectly initialized to 49 | |
| instead of 13 because ConsisID processed 13 latent frames at once in its default and recommended settings, | |
| but cannot be changed to the correct value to ensure backwards compatibility. To create a transformer with | |
| K latent frames, the correct value to pass here would be: ((K - 1) * temporal_compression_ratio + 1).`,name:"sample_frames"},{anchor:"diffusers.ConsisIDTransformer3DModel.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.ConsisIDTransformer3DModel.temporal_compression_ratio",description:`<strong>temporal_compression_ratio</strong> (<code>int</code>, defaults to <code>4</code>) — | |
| The compression ratio across the temporal dimension. See documentation for <code>sample_frames</code>.`,name:"temporal_compression_ratio"},{anchor:"diffusers.ConsisIDTransformer3DModel.max_text_seq_length",description:`<strong>max_text_seq_length</strong> (<code>int</code>, defaults to <code>226</code>) — | |
| The maximum sequence length of the input text embeddings.`,name:"max_text_seq_length"},{anchor:"diffusers.ConsisIDTransformer3DModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, defaults to <code>"gelu-approximate"</code>) — | |
| Activation function to use in feed-forward.`,name:"activation_fn"},{anchor:"diffusers.ConsisIDTransformer3DModel.timestep_activation_fn",description:`<strong>timestep_activation_fn</strong> (<code>str</code>, defaults to <code>"silu"</code>) — | |
| Activation function to use when generating the timestep embeddings.`,name:"timestep_activation_fn"},{anchor:"diffusers.ConsisIDTransformer3DModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to use elementwise affine in normalization layers.`,name:"norm_elementwise_affine"},{anchor:"diffusers.ConsisIDTransformer3DModel.norm_eps",description:`<strong>norm_eps</strong> (<code>float</code>, defaults to <code>1e-5</code>) — | |
| The epsilon value to use in normalization layers.`,name:"norm_eps"},{anchor:"diffusers.ConsisIDTransformer3DModel.spatial_interpolation_scale",description:`<strong>spatial_interpolation_scale</strong> (<code>float</code>, defaults to <code>1.875</code>) — | |
| Scaling factor to apply in 3D positional embeddings across spatial dimensions.`,name:"spatial_interpolation_scale"},{anchor:"diffusers.ConsisIDTransformer3DModel.temporal_interpolation_scale",description:`<strong>temporal_interpolation_scale</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| Scaling factor to apply in 3D positional embeddings across temporal dimensions.`,name:"temporal_interpolation_scale"},{anchor:"diffusers.ConsisIDTransformer3DModel.is_train_face",description:`<strong>is_train_face</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use enable the identity-preserving module during the training process. When set to <code>True</code>, the | |
| model will focus on identity-preserving tasks.`,name:"is_train_face"},{anchor:"diffusers.ConsisIDTransformer3DModel.is_kps",description:`<strong>is_kps</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to enable keypoint for global facial extractor. If <code>True</code>, keypoints will be in the model.`,name:"is_kps"},{anchor:"diffusers.ConsisIDTransformer3DModel.cross_attn_interval",description:`<strong>cross_attn_interval</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| The interval between cross-attention layers in the Transformer architecture. A larger value may reduce the | |
| frequency of cross-attention computations, which can help reduce computational overhead.`,name:"cross_attn_interval"},{anchor:"diffusers.ConsisIDTransformer3DModel.cross_attn_dim_head",description:`<strong>cross_attn_dim_head</strong> (<code>int</code>, optional, defaults to <code>128</code>) — | |
| The dimensionality of each attention head in the cross-attention layers of the Transformer architecture. A | |
| larger value increases the capacity to attend to more complex patterns, but also increases memory and | |
| computation costs.`,name:"cross_attn_dim_head"},{anchor:"diffusers.ConsisIDTransformer3DModel.cross_attn_num_heads",description:`<strong>cross_attn_num_heads</strong> (<code>int</code>, optional, defaults to <code>16</code>) — | |
| The number of attention heads in the cross-attention layers. More heads allow for more parallel attention | |
| mechanisms, capturing diverse relationships between different components of the input, but can also | |
| increase computational requirements.`,name:"cross_attn_num_heads"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_id_dim",description:`<strong>LFE_id_dim</strong> (<code>int</code>, optional, defaults to <code>1280</code>) — | |
| The dimensionality of the identity vector used in the Local Facial Extractor (LFE). This vector represents | |
| the identity features of a face, which are important for tasks like face recognition and identity | |
| preservation across different frames.`,name:"LFE_id_dim"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_vit_dim",description:`<strong>LFE_vit_dim</strong> (<code>int</code>, optional, defaults to <code>1024</code>) — | |
| The dimension of the vision transformer (ViT) output used in the Local Facial Extractor (LFE). This value | |
| dictates the size of the transformer-generated feature vectors that will be processed for facial feature | |
| extraction.`,name:"LFE_vit_dim"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_depth",description:`<strong>LFE_depth</strong> (<code>int</code>, optional, defaults to <code>10</code>) — | |
| The number of layers in the Local Facial Extractor (LFE). Increasing the depth allows the model to capture | |
| more complex representations of facial features, but also increases the computational load.`,name:"LFE_depth"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_dim_head",description:`<strong>LFE_dim_head</strong> (<code>int</code>, optional, defaults to <code>64</code>) — | |
| The dimensionality of each attention head in the Local Facial Extractor (LFE). This parameter affects how | |
| finely the model can process and focus on different parts of the facial features during the extraction | |
| process.`,name:"LFE_dim_head"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_num_heads",description:`<strong>LFE_num_heads</strong> (<code>int</code>, optional, defaults to <code>16</code>) — | |
| The number of attention heads in the Local Facial Extractor (LFE). More heads can improve the model’s | |
| ability to capture diverse facial features, but at the cost of increased computational complexity.`,name:"LFE_num_heads"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_num_id_token",description:`<strong>LFE_num_id_token</strong> (<code>int</code>, optional, defaults to <code>5</code>) — | |
| The number of identity tokens used in the Local Facial Extractor (LFE). This defines how many | |
| identity-related tokens the model will process to ensure face identity preservation during feature | |
| extraction.`,name:"LFE_num_id_token"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_num_querie",description:`<strong>LFE_num_querie</strong> (<code>int</code>, optional, defaults to <code>32</code>) — | |
| The number of query tokens used in the Local Facial Extractor (LFE). These tokens are used to capture | |
| high-frequency face-related information that aids in accurate facial feature extraction.`,name:"LFE_num_querie"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_output_dim",description:`<strong>LFE_output_dim</strong> (<code>int</code>, optional, defaults to <code>2048</code>) — | |
| The output dimension of the Local Facial Extractor (LFE). This dimension determines the size of the feature | |
| vectors produced by the LFE module, which will be used for subsequent tasks such as face recognition or | |
| tracking.`,name:"LFE_output_dim"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_ff_mult",description:`<strong>LFE_ff_mult</strong> (<code>int</code>, optional, defaults to <code>4</code>) — | |
| The multiplication factor applied to the feed-forward network’s hidden layer size in the Local Facial | |
| Extractor (LFE). A higher value increases the model’s capacity to learn more complex facial feature | |
| transformations, but also increases the computation and memory requirements.`,name:"LFE_ff_mult"},{anchor:"diffusers.ConsisIDTransformer3DModel.LFE_num_scale",description:`<strong>LFE_num_scale</strong> (<code>int</code>, optional, defaults to <code>5</code>) — | |
| The number of different scales visual feature. A higher value increases the model’s capacity to learn more | |
| complex facial feature transformations, but also increases the computation and memory requirements.`,name:"LFE_num_scale"},{anchor:"diffusers.ConsisIDTransformer3DModel.local_face_scale",description:`<strong>local_face_scale</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| A scaling factor used to adjust the importance of local facial features in the model. This can influence | |
| how strongly the model focuses on high frequency face-related content.`,name:"local_face_scale"}],source:"https://github.com/huggingface/diffusers/blob/vr_12849/src/diffusers/models/transformers/consisid_transformer_3d.py#L351"}}),M=new Y({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),E=new se({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_12849/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_12849/src/diffusers/models/modeling_outputs.py#L21"}}),L=new ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/consisid_transformer3d.md"}}),{c(){r=l("meta"),k=s(),C=l("p"),q=s(),m(g.$$.fragment),J=s(),m(T.$$.fragment),z=s(),D=l("p"),D.innerHTML=ee,j=s(),b=l("p"),b.textContent=te,Z=s(),m(v.$$.fragment),P=s(),m(x.$$.fragment),H=s(),i=l("div"),m(y.$$.fragment),X=s(),I=l("p"),I.innerHTML=oe,R=s(),m(M.$$.fragment),V=s(),d=l("div"),m(E.$$.fragment),K=s(),F=l("p"),F.innerHTML=ne,W=s(),m(L.$$.fragment),A=s(),$=l("p"),this.h()},l(e){const t=ce("svelte-u9bgzb",document.head);r=c(t,"META",{name:!0,content:!0}),t.forEach(o),k=a(e),C=c(e,"P",{}),S(C).forEach(o),q=a(e),f(g.$$.fragment,e),J=a(e),f(T.$$.fragment,e),z=a(e),D=c(e,"P",{"data-svelte-h":!0}),B(D)!=="svelte-1842u1r"&&(D.innerHTML=ee),j=a(e),b=c(e,"P",{"data-svelte-h":!0}),B(b)!=="svelte-1vuni30"&&(b.textContent=te),Z=a(e),f(v.$$.fragment,e),P=a(e),f(x.$$.fragment,e),H=a(e),i=c(e,"DIV",{class:!0});var G=S(i);f(y.$$.fragment,G),X=a(G),I=c(G,"P",{"data-svelte-h":!0}),B(I)!=="svelte-1m59yg9"&&(I.innerHTML=oe),G.forEach(o),R=a(e),f(M.$$.fragment,e),V=a(e),d=c(e,"DIV",{class:!0});var O=S(d);f(E.$$.fragment,O),K=a(O),F=c(O,"P",{"data-svelte-h":!0}),B(F)!=="svelte-rb9yki"&&(F.innerHTML=ne),O.forEach(o),W=a(e),f(L.$$.fragment,e),A=a(e),$=c(e,"P",{}),S($).forEach(o),this.h()},h(){U(r,"name","hf:doc:metadata"),U(r,"content",he),U(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(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,t){w(document.head,r),n(e,k,t),n(e,C,t),n(e,q,t),u(g,e,t),n(e,J,t),u(T,e,t),n(e,z,t),n(e,D,t),n(e,j,t),n(e,b,t),n(e,Z,t),u(v,e,t),n(e,P,t),u(x,e,t),n(e,H,t),n(e,i,t),u(y,i,null),w(i,X),w(i,I),n(e,R,t),u(M,e,t),n(e,V,t),n(e,d,t),u(E,d,null),w(d,K),w(d,F),n(e,W,t),u(L,e,t),n(e,A,t),n(e,$,t),N=!0},p:re,i(e){N||(p(g.$$.fragment,e),p(T.$$.fragment,e),p(v.$$.fragment,e),p(x.$$.fragment,e),p(y.$$.fragment,e),p(M.$$.fragment,e),p(E.$$.fragment,e),p(L.$$.fragment,e),N=!0)},o(e){h(g.$$.fragment,e),h(T.$$.fragment,e),h(v.$$.fragment,e),h(x.$$.fragment,e),h(y.$$.fragment,e),h(M.$$.fragment,e),h(E.$$.fragment,e),h(L.$$.fragment,e),N=!1},d(e){e&&(o(k),o(C),o(q),o(J),o(z),o(D),o(j),o(b),o(Z),o(P),o(H),o(i),o(R),o(V),o(d),o(W),o(A),o($)),o(r),_(g,e),_(T,e),_(v,e),_(x,e),_(y),_(M,e),_(E),_(L,e)}}}const he='{"title":"ConsisIDTransformer3DModel","local":"consisidtransformer3dmodel","sections":[{"title":"ConsisIDTransformer3DModel","local":"diffusers.ConsisIDTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function _e(Q){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ye extends de{constructor(r){super(),le(this,r,_e,pe,ae,{})}}export{ye as component}; | |
Xet Storage Details
- Size:
- 20.8 kB
- Xet hash:
- 96e05dd645249e610ff69cc363beba0b2da293c99af2a19ef3b4e6e5d302bd31
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.