Buckets:
| import{s as de,n as ie,o as me}from"../chunks/scheduler.8c3d61f6.js";import{S as le,i as ce,g as d,s,r as u,A as fe,h as i,f as n,c as r,j as Z,u as p,x as F,k as q,y as c,a as o,v as h,d as g,t as _,w as T}from"../chunks/index.da70eac4.js";import{D as ee}from"../chunks/Docstring.2187c15d.js";import{C as ue}from"../chunks/CodeBlock.a9c4becf.js";import{H as te,E as pe}from"../chunks/getInferenceSnippets.676f6ee5.js";function he(ne){let m,L,z,N,b,O,w,oe="The model can be loaded with the following code snippet.",j,$,R,y,W,a,M,S,Q,se="The Transformer model introduced in Qwen.",X,f,v,B,k,re="The <code>QwenTransformer2DModel</code> forward method.",P,D,E,l,x,K,C,ae='The output of <a href="/docs/diffusers/pr_12262/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',H,I,V,U,G;return b=new te({props:{title:"QwenImageTransformer2DModel",local:"qwenimagetransformer2dmodel",headingTag:"h1"}}),$=new ue({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFF3ZW5JbWFnZVRyYW5zZm9ybWVyMkRNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwUXdlbkltYWdlVHJhbnNmb3JtZXIyRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbkltYWdlLTIwQiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> QwenImageTransformer2DModel | |
| transformer = QwenImageTransformer2DModel.from_pretrained(<span class="hljs-string">"Qwen/QwenImage-20B"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),y=new te({props:{title:"QwenImageTransformer2DModel",local:"diffusers.QwenImageTransformer2DModel",headingTag:"h2"}}),M=new ee({props:{name:"class diffusers.QwenImageTransformer2DModel",anchor:"diffusers.QwenImageTransformer2DModel",parameters:[{name:"patch_size",val:": int = 2"},{name:"in_channels",val:": int = 64"},{name:"out_channels",val:": typing.Optional[int] = 16"},{name:"num_layers",val:": int = 60"},{name:"attention_head_dim",val:": int = 128"},{name:"num_attention_heads",val:": int = 24"},{name:"joint_attention_dim",val:": int = 3584"},{name:"guidance_embeds",val:": bool = False"},{name:"axes_dims_rope",val:": typing.Tuple[int, int, int] = (16, 56, 56)"}],parametersDescription:[{anchor:"diffusers.QwenImageTransformer2DModel.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.QwenImageTransformer2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>64</code>) — | |
| The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.QwenImageTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| The number of channels in the output. If not specified, it defaults to <code>in_channels</code>.`,name:"out_channels"},{anchor:"diffusers.QwenImageTransformer2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>60</code>) — | |
| The number of layers of dual stream DiT blocks to use.`,name:"num_layers"},{anchor:"diffusers.QwenImageTransformer2DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The number of dimensions to use for each attention head.`,name:"attention_head_dim"},{anchor:"diffusers.QwenImageTransformer2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) — | |
| The number of attention heads to use.`,name:"num_attention_heads"},{anchor:"diffusers.QwenImageTransformer2DModel.joint_attention_dim",description:`<strong>joint_attention_dim</strong> (<code>int</code>, defaults to <code>3584</code>) — | |
| The number of dimensions to use for the joint attention (embedding/channel dimension of | |
| <code>encoder_hidden_states</code>).`,name:"joint_attention_dim"},{anchor:"diffusers.QwenImageTransformer2DModel.guidance_embeds",description:`<strong>guidance_embeds</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use guidance embeddings for guidance-distilled variant of the model.`,name:"guidance_embeds"},{anchor:"diffusers.QwenImageTransformer2DModel.axes_dims_rope",description:`<strong>axes_dims_rope</strong> (<code>Tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) — | |
| The dimensions to use for the rotary positional embeddings.`,name:"axes_dims_rope"}],source:"https://github.com/huggingface/diffusers/blob/vr_12262/src/diffusers/models/transformers/transformer_qwenimage.py#L473"}}),v=new ee({props:{name:"forward",anchor:"diffusers.QwenImageTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor = None"},{name:"encoder_hidden_states_mask",val:": Tensor = None"},{name:"timestep",val:": LongTensor = None"},{name:"img_shapes",val:": typing.Optional[typing.List[typing.Tuple[int, int, int]]] = None"},{name:"txt_seq_lens",val:": typing.Optional[typing.List[int]] = None"},{name:"guidance",val:": Tensor = None"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"controlnet_block_samples",val:" = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.QwenImageTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, image_sequence_length, in_channels)</code>) — | |
| Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.QwenImageTransformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, text_sequence_length, joint_attention_dim)</code>) — | |
| Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.QwenImageTransformer2DModel.forward.encoder_hidden_states_mask",description:`<strong>encoder_hidden_states_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, text_sequence_length)</code>) — | |
| Mask of the input conditions.`,name:"encoder_hidden_states_mask"},{anchor:"diffusers.QwenImageTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>) — | |
| Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.QwenImageTransformer2DModel.forward.attention_kwargs",description:`<strong>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:"attention_kwargs"},{anchor:"diffusers.QwenImageTransformer2DModel.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"}],source:"https://github.com/huggingface/diffusers/blob/vr_12262/src/diffusers/models/transformers/transformer_qwenimage.py#L548",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> | |
| `}}),D=new te({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),x=new ee({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_12262/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_12262/src/diffusers/models/modeling_outputs.py#L21"}}),I=new pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/qwenimage_transformer2d.md"}}),{c(){m=d("meta"),L=s(),z=d("p"),N=s(),u(b.$$.fragment),O=s(),w=d("p"),w.textContent=oe,j=s(),u($.$$.fragment),R=s(),u(y.$$.fragment),W=s(),a=d("div"),u(M.$$.fragment),S=s(),Q=d("p"),Q.textContent=se,X=s(),f=d("div"),u(v.$$.fragment),B=s(),k=d("p"),k.innerHTML=re,P=s(),u(D.$$.fragment),E=s(),l=d("div"),u(x.$$.fragment),K=s(),C=d("p"),C.innerHTML=ae,H=s(),u(I.$$.fragment),V=s(),U=d("p"),this.h()},l(e){const t=fe("svelte-u9bgzb",document.head);m=i(t,"META",{name:!0,content:!0}),t.forEach(n),L=r(e),z=i(e,"P",{}),Z(z).forEach(n),N=r(e),p(b.$$.fragment,e),O=r(e),w=i(e,"P",{"data-svelte-h":!0}),F(w)!=="svelte-1vuni30"&&(w.textContent=oe),j=r(e),p($.$$.fragment,e),R=r(e),p(y.$$.fragment,e),W=r(e),a=i(e,"DIV",{class:!0});var J=Z(a);p(M.$$.fragment,J),S=r(J),Q=i(J,"P",{"data-svelte-h":!0}),F(Q)!=="svelte-1kyfnic"&&(Q.textContent=se),X=r(J),f=i(J,"DIV",{class:!0});var Y=Z(f);p(v.$$.fragment,Y),B=r(Y),k=i(Y,"P",{"data-svelte-h":!0}),F(k)!=="svelte-htyx6t"&&(k.innerHTML=re),Y.forEach(n),J.forEach(n),P=r(e),p(D.$$.fragment,e),E=r(e),l=i(e,"DIV",{class:!0});var A=Z(l);p(x.$$.fragment,A),K=r(A),C=i(A,"P",{"data-svelte-h":!0}),F(C)!=="svelte-12z3eh7"&&(C.innerHTML=ae),A.forEach(n),H=r(e),p(I.$$.fragment,e),V=r(e),U=i(e,"P",{}),Z(U).forEach(n),this.h()},h(){q(m,"name","hf:doc:metadata"),q(m,"content",ge),q(f,"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"),q(l,"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){c(document.head,m),o(e,L,t),o(e,z,t),o(e,N,t),h(b,e,t),o(e,O,t),o(e,w,t),o(e,j,t),h($,e,t),o(e,R,t),h(y,e,t),o(e,W,t),o(e,a,t),h(M,a,null),c(a,S),c(a,Q),c(a,X),c(a,f),h(v,f,null),c(f,B),c(f,k),o(e,P,t),h(D,e,t),o(e,E,t),o(e,l,t),h(x,l,null),c(l,K),c(l,C),o(e,H,t),h(I,e,t),o(e,V,t),o(e,U,t),G=!0},p:ie,i(e){G||(g(b.$$.fragment,e),g($.$$.fragment,e),g(y.$$.fragment,e),g(M.$$.fragment,e),g(v.$$.fragment,e),g(D.$$.fragment,e),g(x.$$.fragment,e),g(I.$$.fragment,e),G=!0)},o(e){_(b.$$.fragment,e),_($.$$.fragment,e),_(y.$$.fragment,e),_(M.$$.fragment,e),_(v.$$.fragment,e),_(D.$$.fragment,e),_(x.$$.fragment,e),_(I.$$.fragment,e),G=!1},d(e){e&&(n(L),n(z),n(N),n(O),n(w),n(j),n(R),n(W),n(a),n(P),n(E),n(l),n(H),n(V),n(U)),n(m),T(b,e),T($,e),T(y,e),T(M),T(v),T(D,e),T(x),T(I,e)}}}const ge='{"title":"QwenImageTransformer2DModel","local":"qwenimagetransformer2dmodel","sections":[{"title":"QwenImageTransformer2DModel","local":"diffusers.QwenImageTransformer2DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function _e(ne){return me(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Me extends le{constructor(m){super(),ce(this,m,_e,he,de,{})}}export{Me as component}; | |
Xet Storage Details
- Size:
- 12 kB
- Xet hash:
- ae8a11d107a56ab9ba174987da7d742a1b6eaf29ab6d9ff222a617fe76a7bde3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.