Buckets:

HuggingFaceDocBuilder's picture
download
raw
18.6 kB
import{s as Xe,n as et,o as tt}from"../chunks/scheduler.53228c21.js";import{S as ot,i as nt,e as d,s as r,c as m,h as rt,a as i,d as t,b as s,f as _,g as u,j as $,k as v,l as o,m as l,n as p,t as f,o as g,p as h}from"../chunks/index.cac5d66a.js";import{C as st}from"../chunks/CopyLLMTxtMenu.d3355f38.js";import{D as L}from"../chunks/Docstring.41979c71.js";import{C as at}from"../chunks/CodeBlock.606cbaf4.js";import{H as ye,E as dt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e4b76f09.js";function it(Ne){let b,re,oe,se,K,ae,C,de,Q,Ue="The model can be loaded with the following code snippet.",ie,E,le,O,ce,a,k,Ie,R,We="A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos.",Ae,S,Ze=`This model inherits from <a href="/docs/diffusers/pr_13803/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for it’s generic methods implemented
for all models (such as downloading or saving).`,De,T,M,Ke,H,je="Decode a batch of images.",Ce,y,q,Qe,F,Re="Encode a batch of images into latents.",Ee,I,G,Oe,J,Se=`Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
processing larger images.`,ke,B,P,Me,A,V,qe,Y,He="Decode a batch of images using a tiled decoder.",Ge,D,z,Pe,X,Fe="Encode a batch of images using a tiled encoder.",me,N,ue,w,U,Ve,ee,Je="Output of AutoencoderKL encoding method.",pe,W,fe,x,Z,ze,te,Be="Output of decoding method.",ge,j,he,ne,_e;return K=new st({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),C=new ye({props:{title:"AutoencoderKLQwenImage",local:"autoencoderklqwenimage",headingTag:"h1"}}),E=new at({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xRd2VuSW1hZ2UlMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMUXdlbkltYWdlLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbkltYWdlLTIwQiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnZhZSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLQwenImage
vae = AutoencoderKLQwenImage.from_pretrained(<span class="hljs-string">&quot;Qwen/QwenImage-20B&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>)`,lang:"python",wrap:!1}}),O=new ye({props:{title:"AutoencoderKLQwenImage",local:"diffusers.AutoencoderKLQwenImage",headingTag:"h2"}}),k=new L({props:{name:"class diffusers.AutoencoderKLQwenImage",anchor:"diffusers.AutoencoderKLQwenImage",parameters:[{name:"base_dim",val:": int = 96"},{name:"z_dim",val:": int = 16"},{name:"dim_mult",val:": list = [1, 2, 4, 4]"},{name:"num_res_blocks",val:": int = 2"},{name:"attn_scales",val:": list = []"},{name:"temperal_downsample",val:": list = [False, True, True]"},{name:"dropout",val:": float = 0.0"},{name:"input_channels",val:": int = 3"},{name:"latents_mean",val:": list = [-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921]"},{name:"latents_std",val:": list = [2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916]"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L673"}}),M=new L({props:{name:"decode",anchor:"diffusers.AutoencoderKLQwenImage.decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage.decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLQwenImage.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L866",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If return_dict is True, a <code>~models.vae.DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is
returned.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>~models.vae.DecoderOutput</code> or <code>tuple</code></p>
`}}),q=new L({props:{name:"encode",anchor:"diffusers.AutoencoderKLQwenImage.encode",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage.encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of images.",name:"x"},{anchor:"diffusers.AutoencoderKLQwenImage.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <code>~models.autoencoder_kl.AutoencoderKLOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L814",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The latent representations of the encoded videos. If <code>return_dict</code> is True, a
<code>~models.autoencoder_kl.AutoencoderKLOutput</code> is returned, otherwise a plain <code>tuple</code> is returned.</p>
`}}),G=new L({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLQwenImage.enable_tiling",parameters:[{name:"tile_sample_min_height",val:": int | None = None"},{name:"tile_sample_min_width",val:": int | None = None"},{name:"tile_sample_stride_height",val:": float | None = None"},{name:"tile_sample_stride_width",val:": float | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum height required for a sample to be separated into tiles across the height dimension.`,name:"tile_sample_min_height"},{anchor:"diffusers.AutoencoderKLQwenImage.enable_tiling.tile_sample_min_width",description:`<strong>tile_sample_min_width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum width required for a sample to be separated into tiles across the width dimension.`,name:"tile_sample_min_width"},{anchor:"diffusers.AutoencoderKLQwenImage.enable_tiling.tile_sample_stride_height",description:`<strong>tile_sample_stride_height</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The minimum amount of overlap between two consecutive vertical tiles. This is to ensure that there are
no tiling artifacts produced across the height dimension.`,name:"tile_sample_stride_height"},{anchor:"diffusers.AutoencoderKLQwenImage.enable_tiling.tile_sample_stride_width",description:`<strong>tile_sample_stride_width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The stride between two consecutive horizontal tiles. This is to ensure that there are no tiling
artifacts produced across the width dimension.`,name:"tile_sample_stride_width"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L744"}}),P=new L({props:{name:"forward",anchor:"diffusers.AutoencoderKLQwenImage.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": torch._C.Generator | None = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLQwenImage.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to sample from the posterior.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLQwenImage.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.AutoencoderKLQwenImage.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make sampling
deterministic.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L1036"}}),V=new L({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLQwenImage.tiled_decode",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLQwenImage.tiled_decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~models.vae.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L973",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If return_dict is True, a <code>~models.vae.DecoderOutput</code> is returned, otherwise a plain <code>tuple</code> is
returned.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>~models.vae.DecoderOutput</code> or <code>tuple</code></p>
`}}),z=new L({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLQwenImage.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of videos.",name:"x"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L907",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The latent representation of the encoded videos.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>torch.Tensor</code></p>
`}}),N=new ye({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),U=new L({props:{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",parameters:[{name:"latent_dist",val:": DiagonalGaussianDistribution"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput.latent_dist",description:`<strong>latent_dist</strong> (<code>DiagonalGaussianDistribution</code>) &#x2014;
Encoded outputs of <code>Encoder</code> represented as the mean and logvar of <code>DiagonalGaussianDistribution</code>.
<code>DiagonalGaussianDistribution</code> allows for sampling latents from the distribution.`,name:"latent_dist"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/modeling_outputs.py#L7"}}),W=new ye({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),Z=new L({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": torch.FloatTensor | None = None"}],parametersDescription:[{anchor:"diffusers.models.autoencoders.vae.DecoderOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
The decoded output sample from the last layer of the model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_13803/src/diffusers/models/autoencoders/vae.py#L46"}}),j=new dt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_qwenimage.md"}}),{c(){b=d("meta"),re=r(),oe=d("p"),se=r(),m(K.$$.fragment),ae=r(),m(C.$$.fragment),de=r(),Q=d("p"),Q.textContent=Ue,ie=r(),m(E.$$.fragment),le=r(),m(O.$$.fragment),ce=r(),a=d("div"),m(k.$$.fragment),Ie=r(),R=d("p"),R.textContent=We,Ae=r(),S=d("p"),S.innerHTML=Ze,De=r(),T=d("div"),m(M.$$.fragment),Ke=r(),H=d("p"),H.textContent=je,Ce=r(),y=d("div"),m(q.$$.fragment),Qe=r(),F=d("p"),F.textContent=Re,Ee=r(),I=d("div"),m(G.$$.fragment),Oe=r(),J=d("p"),J.textContent=Se,ke=r(),B=d("div"),m(P.$$.fragment),Me=r(),A=d("div"),m(V.$$.fragment),qe=r(),Y=d("p"),Y.textContent=He,Ge=r(),D=d("div"),m(z.$$.fragment),Pe=r(),X=d("p"),X.textContent=Fe,me=r(),m(N.$$.fragment),ue=r(),w=d("div"),m(U.$$.fragment),Ve=r(),ee=d("p"),ee.textContent=Je,pe=r(),m(W.$$.fragment),fe=r(),x=d("div"),m(Z.$$.fragment),ze=r(),te=d("p"),te.textContent=Be,ge=r(),m(j.$$.fragment),he=r(),ne=d("p"),this.h()},l(e){const n=rt("svelte-u9bgzb",document.head);b=i(n,"META",{name:!0,content:!0}),n.forEach(t),re=s(e),oe=i(e,"P",{}),_(oe).forEach(t),se=s(e),u(K.$$.fragment,e),ae=s(e),u(C.$$.fragment,e),de=s(e),Q=i(e,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-1vuni30"&&(Q.textContent=Ue),ie=s(e),u(E.$$.fragment,e),le=s(e),u(O.$$.fragment,e),ce=s(e),a=i(e,"DIV",{class:!0});var c=_(a);u(k.$$.fragment,c),Ie=s(c),R=i(c,"P",{"data-svelte-h":!0}),$(R)!=="svelte-bm840b"&&(R.textContent=We),Ae=s(c),S=i(c,"P",{"data-svelte-h":!0}),$(S)!=="svelte-13nky0p"&&(S.innerHTML=Ze),De=s(c),T=i(c,"DIV",{class:!0});var ve=_(T);u(M.$$.fragment,ve),Ke=s(ve),H=i(ve,"P",{"data-svelte-h":!0}),$(H)!=="svelte-pmyhd2"&&(H.textContent=je),ve.forEach(t),Ce=s(c),y=i(c,"DIV",{class:!0});var $e=_(y);u(q.$$.fragment,$e),Qe=s($e),F=i($e,"P",{"data-svelte-h":!0}),$(F)!=="svelte-h5bpgz"&&(F.textContent=Re),$e.forEach(t),Ee=s(c),I=i(c,"DIV",{class:!0});var be=_(I);u(G.$$.fragment,be),Oe=s(be),J=i(be,"P",{"data-svelte-h":!0}),$(J)!=="svelte-1xwrf7t"&&(J.textContent=Se),be.forEach(t),ke=s(c),B=i(c,"DIV",{class:!0});var Ye=_(B);u(P.$$.fragment,Ye),Ye.forEach(t),Me=s(c),A=i(c,"DIV",{class:!0});var we=_(A);u(V.$$.fragment,we),qe=s(we),Y=i(we,"P",{"data-svelte-h":!0}),$(Y)!=="svelte-1vrxp2b"&&(Y.textContent=He),we.forEach(t),Ge=s(c),D=i(c,"DIV",{class:!0});var xe=_(D);u(z.$$.fragment,xe),Pe=s(xe),X=i(xe,"P",{"data-svelte-h":!0}),$(X)!=="svelte-1un5fcn"&&(X.textContent=Fe),xe.forEach(t),c.forEach(t),me=s(e),u(N.$$.fragment,e),ue=s(e),w=i(e,"DIV",{class:!0});var Le=_(w);u(U.$$.fragment,Le),Ve=s(Le),ee=i(Le,"P",{"data-svelte-h":!0}),$(ee)!=="svelte-1vsc7ag"&&(ee.textContent=Je),Le.forEach(t),pe=s(e),u(W.$$.fragment,e),fe=s(e),x=i(e,"DIV",{class:!0});var Te=_(x);u(Z.$$.fragment,Te),ze=s(Te),te=i(Te,"P",{"data-svelte-h":!0}),$(te)!=="svelte-18u8upa"&&(te.textContent=Be),Te.forEach(t),ge=s(e),u(j.$$.fragment,e),he=s(e),ne=i(e,"P",{}),_(ne).forEach(t),this.h()},h(){v(b,"name","hf:doc:metadata"),v(b,"content",lt),v(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(x,"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){o(document.head,b),l(e,re,n),l(e,oe,n),l(e,se,n),p(K,e,n),l(e,ae,n),p(C,e,n),l(e,de,n),l(e,Q,n),l(e,ie,n),p(E,e,n),l(e,le,n),p(O,e,n),l(e,ce,n),l(e,a,n),p(k,a,null),o(a,Ie),o(a,R),o(a,Ae),o(a,S),o(a,De),o(a,T),p(M,T,null),o(T,Ke),o(T,H),o(a,Ce),o(a,y),p(q,y,null),o(y,Qe),o(y,F),o(a,Ee),o(a,I),p(G,I,null),o(I,Oe),o(I,J),o(a,ke),o(a,B),p(P,B,null),o(a,Me),o(a,A),p(V,A,null),o(A,qe),o(A,Y),o(a,Ge),o(a,D),p(z,D,null),o(D,Pe),o(D,X),l(e,me,n),p(N,e,n),l(e,ue,n),l(e,w,n),p(U,w,null),o(w,Ve),o(w,ee),l(e,pe,n),p(W,e,n),l(e,fe,n),l(e,x,n),p(Z,x,null),o(x,ze),o(x,te),l(e,ge,n),p(j,e,n),l(e,he,n),l(e,ne,n),_e=!0},p:et,i(e){_e||(f(K.$$.fragment,e),f(C.$$.fragment,e),f(E.$$.fragment,e),f(O.$$.fragment,e),f(k.$$.fragment,e),f(M.$$.fragment,e),f(q.$$.fragment,e),f(G.$$.fragment,e),f(P.$$.fragment,e),f(V.$$.fragment,e),f(z.$$.fragment,e),f(N.$$.fragment,e),f(U.$$.fragment,e),f(W.$$.fragment,e),f(Z.$$.fragment,e),f(j.$$.fragment,e),_e=!0)},o(e){g(K.$$.fragment,e),g(C.$$.fragment,e),g(E.$$.fragment,e),g(O.$$.fragment,e),g(k.$$.fragment,e),g(M.$$.fragment,e),g(q.$$.fragment,e),g(G.$$.fragment,e),g(P.$$.fragment,e),g(V.$$.fragment,e),g(z.$$.fragment,e),g(N.$$.fragment,e),g(U.$$.fragment,e),g(W.$$.fragment,e),g(Z.$$.fragment,e),g(j.$$.fragment,e),_e=!1},d(e){e&&(t(re),t(oe),t(se),t(ae),t(de),t(Q),t(ie),t(le),t(ce),t(a),t(me),t(ue),t(w),t(pe),t(fe),t(x),t(ge),t(he),t(ne)),t(b),h(K,e),h(C,e),h(E,e),h(O,e),h(k),h(M),h(q),h(G),h(P),h(V),h(z),h(N,e),h(U),h(W,e),h(Z),h(j,e)}}}const lt='{"title":"AutoencoderKLQwenImage","local":"autoencoderklqwenimage","sections":[{"title":"AutoencoderKLQwenImage","local":"diffusers.AutoencoderKLQwenImage","sections":[],"depth":2},{"title":"AutoencoderKLOutput","local":"diffusers.models.modeling_outputs.AutoencoderKLOutput","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function ct(Ne){return tt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _t extends ot{constructor(b){super(),nt(this,b,ct,it,Xe,{})}}export{_t as component};

Xet Storage Details

Size:
18.6 kB
·
Xet hash:
a99ada5b60d0f74af60be0bc80c0047c389ad838bb312895a850376313fd590b

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