Buckets:
| import"../chunks/DsnmJJEf.js";import{i as S,h as j,C as z,H as g,D as o,E as q,s as N}from"../chunks/BtE7mKSK.js";import{p as L,o as A,s as e,f as I,a as b,b as P,c as n,d as D,n as r,r as t}from"../chunks/jDjavuwI.js";const C='{"title":"SD3 Transformer Model","local":"sd3-transformer-model","sections":[{"title":"SD3Transformer2DModel","local":"diffusers.SD3Transformer2DModel","sections":[],"depth":2}],"depth":1}';var E=D('<meta name="hf:doc:metadata"/>'),O=D(`<p></p> <!> <!> <p>The Transformer model introduced in <a href="https://hf.co/papers/2403.03206" rel="nofollow">Stable Diffusion 3</a>. Its novelty lies in the MMDiT transformer block.</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"><!> <p>The Transformer model introduced in <a href="https://huggingface.co/papers/2403.03206" rel="nofollow">Stable Diffusion 3</a>.</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"><!> <p>Sets the attention processor to use <a href="https://huggingface.co/blog/reformer#2-chunked-feed-forward-layers" rel="nofollow">feed forward | |
| chunking</a>.</p></div> <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_13966/en/api/models/sd3_transformer2d#diffusers.SD3Transformer2DModel">SD3Transformer2DModel</a> forward method.</p></div> <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>Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, key, value) | |
| are fused. For cross-attention modules, key and value projection matrices are fused.</p> <blockquote class="warning"><p>> This API is 🧪 experimental.</p></blockquote></div> <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>Disables the fused QKV projection if enabled.</p> <blockquote class="warning"><p>> This API is 🧪 experimental.</p></blockquote></div></div> <!> <p></p>`,1);function Q(T,v){L(v,!1),A(()=>{new URLSearchParams(window.location.search).get("fw")}),S();var c=O();j("g8819z",h=>{var _=E();N(_,"content",C),b(h,_)});var l=e(I(c),2);z(l,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var m=e(l,2);g(m,{title:"SD3 Transformer Model",local:"sd3-transformer-model",headingTag:"h1"});var f=e(m,4);g(f,{title:"SD3Transformer2DModel",local:"diffusers.SD3Transformer2DModel",headingTag:"h2"});var s=e(f,2),p=n(s);o(p,{name:"class diffusers.SD3Transformer2DModel",anchor:"diffusers.SD3Transformer2DModel",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_sd3.py#L79",parameters:[{name:"sample_size",val:": int = 128"},{name:"patch_size",val:": int = 2"},{name:"in_channels",val:": int = 16"},{name:"num_layers",val:": int = 18"},{name:"attention_head_dim",val:": int = 64"},{name:"num_attention_heads",val:": int = 18"},{name:"joint_attention_dim",val:": int = 4096"},{name:"caption_projection_dim",val:": int = 1152"},{name:"pooled_projection_dim",val:": int = 2048"},{name:"out_channels",val:": int = 16"},{name:"pos_embed_max_size",val:": int = 96"},{name:"dual_attention_layers",val:": tuple = ()"},{name:"qk_norm",val:": str | None = None"}],parametersDescription:[{anchor:"diffusers.SD3Transformer2DModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The width/height of the latents. This is fixed during training since it is used to learn a number of | |
| position embeddings.`,name:"sample_size"},{anchor:"diffusers.SD3Transformer2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| Patch size to turn the input data into small patches.`,name:"patch_size"},{anchor:"diffusers.SD3Transformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of latent channels in the input.`,name:"in_channels"},{anchor:"diffusers.SD3Transformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>18</code>) — | |
| The number of layers of transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.SD3Transformer2DModel.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.SD3Transformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>18</code>) — | |
| The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.SD3Transformer2DModel.joint_attention_dim",description:`<strong>joint_attention_dim</strong> (<code>int</code>, defaults to <code>4096</code>) — | |
| The embedding dimension to use for joint text-image attention.`,name:"joint_attention_dim"},{anchor:"diffusers.SD3Transformer2DModel.caption_projection_dim",description:`<strong>caption_projection_dim</strong> (<code>int</code>, defaults to <code>1152</code>) — | |
| The embedding dimension of caption embeddings.`,name:"caption_projection_dim"},{anchor:"diffusers.SD3Transformer2DModel.pooled_projection_dim",description:`<strong>pooled_projection_dim</strong> (<code>int</code>, defaults to <code>2048</code>) — | |
| The embedding dimension of pooled text projections.`,name:"pooled_projection_dim"},{anchor:"diffusers.SD3Transformer2DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of latent channels in the output.`,name:"out_channels"},{anchor:"diffusers.SD3Transformer2DModel.pos_embed_max_size",description:`<strong>pos_embed_max_size</strong> (<code>int</code>, defaults to <code>96</code>) — | |
| The maximum latent height/width of positional embeddings.`,name:"pos_embed_max_size"},{anchor:"diffusers.SD3Transformer2DModel.dual_attention_layers",description:`<strong>dual_attention_layers</strong> (<code>tuple[int, ...]</code>, defaults to <code>()</code>) — | |
| The number of dual-stream transformer blocks to use.`,name:"dual_attention_layers"},{anchor:"diffusers.SD3Transformer2DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| The normalization to use for query and key in the attention layer. If <code>None</code>, no normalization is used.`,name:"qk_norm"}]});var d=e(p,4),x=n(d);o(x,{name:"enable_forward_chunking",anchor:"diffusers.SD3Transformer2DModel.enable_forward_chunking",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_sd3.py#L175",parameters:[{name:"chunk_size",val:": int | None = None"},{name:"dim",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.SD3Transformer2DModel.enable_forward_chunking.chunk_size",description:`<strong>chunk_size</strong> (<code>int</code>, <em>optional</em>) — | |
| The chunk size of the feed-forward layers. If not specified, will run feed-forward layer individually | |
| over each tensor of dim=<code>dim</code>.`,name:"chunk_size"},{anchor:"diffusers.SD3Transformer2DModel.enable_forward_chunking.dim",description:`<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>0</code>) — | |
| The dimension over which the feed-forward computation should be chunked. Choose between dim=0 (batch) | |
| or dim=1 (sequence length).`,name:"dim"}]}),r(2),t(d);var a=e(d,2),k=n(a);o(k,{name:"forward",anchor:"diffusers.SD3Transformer2DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_sd3.py#L248",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor = None"},{name:"pooled_projections",val:": Tensor = None"},{name:"timestep",val:": LongTensor = None"},{name:"block_controlnet_hidden_states",val:": list = None"},{name:"joint_attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"},{name:"skip_layers",val:": list[int] | None = None"}],parametersDescription:[{anchor:"diffusers.SD3Transformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch size, channel, height, width)</code>) — | |
| Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.SD3Transformer2DModel.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.SD3Transformer2DModel.forward.pooled_projections",description:`<strong>pooled_projections</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, projection_dim)</code>) — | |
| Embeddings projected from the embeddings of input conditions.`,name:"pooled_projections"},{anchor:"diffusers.SD3Transformer2DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) — | |
| Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.SD3Transformer2DModel.forward.block_controlnet_hidden_states",description:`<strong>block_controlnet_hidden_states</strong> (<code>list</code> of <code>torch.Tensor</code>) — | |
| A list of tensors that if specified are added to the residuals of transformer blocks.`,name:"block_controlnet_hidden_states"},{anchor:"diffusers.SD3Transformer2DModel.forward.joint_attention_kwargs",description:`<strong>joint_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:"joint_attention_kwargs"},{anchor:"diffusers.SD3Transformer2DModel.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.SD3Transformer2DModel.forward.skip_layers",description:`<strong>skip_layers</strong> (<code>list</code> of <code>int</code>, <em>optional</em>) — | |
| A list of layer indices to skip during the forward pass.`,name:"skip_layers"}],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> | |
| `}),r(2),t(a);var i=e(a,2),w=n(i);o(w,{name:"fuse_qkv_projections",anchor:"diffusers.SD3Transformer2DModel.fuse_qkv_projections",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_sd3.py#L217",parameters:[]}),r(4),t(i);var u=e(i,2),M=n(u);o(M,{name:"unfuse_qkv_projections",anchor:"diffusers.SD3Transformer2DModel.unfuse_qkv_projections",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_sd3.py#L239",parameters:[]}),r(4),t(u),t(s);var y=e(s,2);q(y,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/sd3_transformer2d.md"}),r(2),b(T,c),P()}export{Q as component}; | |
Xet Storage Details
- Size:
- 11.8 kB
- Xet hash:
- ac86323900ca72482c50c2b7257139b16f51fe1be39a27317a66c8f4a5ad88d9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.