import{s as ot,n as at,o as st}from"../chunks/scheduler.53228c21.js";import{S as it,i as dt,e as i,s as r,c as m,h as lt,a as d,d as n,b as o,f as _,g as c,j as $,k as b,l as t,m as u,n as p,t as f,o as g,p as h}from"../chunks/index.100fac89.js";import{C as ut}from"../chunks/CopyLLMTxtMenu.494046bd.js";import{D as v}from"../chunks/Docstring.9bbf7d33.js";import{C as mt}from"../chunks/CodeBlock.d30a6509.js";import{H as Ge,E as ct}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8999c127.js";function pt(Ne){let y,se,oe,ie,D,de,R,le,C,Fe='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/Tencent-Hunyuan/HunyuanImage-2.1" rel="nofollow">HunyuanImage2.1</a> for its refiner pipeline.',ue,V,Se="The model can be loaded with the following code snippet.",me,E,ce,K,pe,a,k,Le,q,qe=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. Used for
HunyuanImage-2.1 Refiner.`,He,U,Ue=`This model inherits from <a href="/docs/diffusers/main/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).`,Ae,j,J,De,w,M,Re,X,je=`Disable sliced VAE decoding. If <code>enable_slicing</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ce,T,Z,Ve,B,Xe=`Disable tiled VAE decoding. If <code>enable_tiling</code> was previously enabled, this method will go back to computing
decoding in one step.`,Ee,I,O,Ke,Y,Be=`Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.`,ke,L,P,Je,Q,Ye=`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.`,Me,ee,W,Ze,H,z,Oe,te,Qe="Decode a batch of images using a tiled decoder.",Pe,A,G,We,ne,et="Encode a batch of images using a tiled encoder.",fe,N,ge,x,F,ze,re,tt="Output of decoding method.",he,S,_e,ae,be;return D=new ut({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),R=new Ge({props:{title:"AutoencoderKLHunyuanImageRefiner",local:"autoencoderklhunyuanimagerefiner",headingTag:"h1"}}),E=new mt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xIdW55dWFuSW1hZ2VSZWZpbmVyJTBBJTBBdmFlJTIwJTNEJTIwQXV0b2VuY29kZXJLTEh1bnl1YW5JbWFnZVJlZmluZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmh1bnl1YW52aWRlby1jb21tdW5pdHklMkZIdW55dWFuSW1hZ2UtMi4xLVJlZmluZXItRGlmZnVzZXJzJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLHunyuanImageRefiner

vae = AutoencoderKLHunyuanImageRefiner.from_pretrained(<span class="hljs-string">&quot;hunyuanvideo-community/HunyuanImage-2.1-Refiner-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),K=new Ge({props:{title:"AutoencoderKLHunyuanImageRefiner",local:"diffusers.AutoencoderKLHunyuanImageRefiner",headingTag:"h2"}}),k=new v({props:{name:"class diffusers.AutoencoderKLHunyuanImageRefiner",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"latent_channels",val:": int = 32"},{name:"block_out_channels",val:": typing.Tuple[int, ...] = (128, 256, 512, 1024, 1024)"},{name:"layers_per_block",val:": int = 2"},{name:"spatial_compression_ratio",val:": int = 16"},{name:"temporal_compression_ratio",val:": int = 4"},{name:"downsample_match_channel",val:": bool = True"},{name:"upsample_match_channel",val:": bool = True"},{name:"scaling_factor",val:": float = 1.03682"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L587"}}),J=new v({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),M=new v({props:{name:"disable_slicing",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.disable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L702"}}),Z=new v({props:{name:"disable_tiling",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.disable_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L688"}}),O=new v({props:{name:"enable_slicing",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.enable_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L695"}}),P=new v({props:{name:"enable_tiling",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.enable_tiling",parameters:[{name:"tile_sample_min_height",val:": typing.Optional[int] = None"},{name:"tile_sample_min_width",val:": typing.Optional[int] = None"},{name:"tile_sample_stride_height",val:": typing.Optional[float] = None"},{name:"tile_sample_stride_width",val:": typing.Optional[float] = None"},{name:"tile_overlap_factor",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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.AutoencoderKLHunyuanImageRefiner.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.AutoencoderKLHunyuanImageRefiner.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.AutoencoderKLHunyuanImageRefiner.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/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L656"}}),W=new v({props:{name:"forward",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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.AutoencoderKLHunyuanImageRefiner.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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L912"}}),z=new v({props:{name:"tiled_decode",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.tiled_decode",parameters:[{name:"z",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L858",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>
`}}),G=new v({props:{name:"tiled_encode",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.tiled_encode",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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/main/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L808",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 Ge({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),F=new v({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": typing.Optional[torch.FloatTensor] = 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/main/src/diffusers/models/autoencoders/vae.py#L47"}}),S=new ct({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_hunyuanimage_refiner.md"}}),{c(){y=i("meta"),se=r(),oe=i("p"),ie=r(),m(D.$$.fragment),de=r(),m(R.$$.fragment),le=r(),C=i("p"),C.innerHTML=Fe,ue=r(),V=i("p"),V.textContent=Se,me=r(),m(E.$$.fragment),ce=r(),m(K.$$.fragment),pe=r(),a=i("div"),m(k.$$.fragment),Le=r(),q=i("p"),q.textContent=qe,He=r(),U=i("p"),U.innerHTML=Ue,Ae=r(),j=i("div"),m(J.$$.fragment),De=r(),w=i("div"),m(M.$$.fragment),Re=r(),X=i("p"),X.innerHTML=je,Ce=r(),T=i("div"),m(Z.$$.fragment),Ve=r(),B=i("p"),B.innerHTML=Xe,Ee=r(),I=i("div"),m(O.$$.fragment),Ke=r(),Y=i("p"),Y.textContent=Be,ke=r(),L=i("div"),m(P.$$.fragment),Je=r(),Q=i("p"),Q.textContent=Ye,Me=r(),ee=i("div"),m(W.$$.fragment),Ze=r(),H=i("div"),m(z.$$.fragment),Oe=r(),te=i("p"),te.textContent=Qe,Pe=r(),A=i("div"),m(G.$$.fragment),We=r(),ne=i("p"),ne.textContent=et,fe=r(),m(N.$$.fragment),ge=r(),x=i("div"),m(F.$$.fragment),ze=r(),re=i("p"),re.textContent=tt,he=r(),m(S.$$.fragment),_e=r(),ae=i("p"),this.h()},l(e){const s=lt("svelte-u9bgzb",document.head);y=d(s,"META",{name:!0,content:!0}),s.forEach(n),se=o(e),oe=d(e,"P",{}),_(oe).forEach(n),ie=o(e),c(D.$$.fragment,e),de=o(e),c(R.$$.fragment,e),le=o(e),C=d(e,"P",{"data-svelte-h":!0}),$(C)!=="svelte-hewd3q"&&(C.innerHTML=Fe),ue=o(e),V=d(e,"P",{"data-svelte-h":!0}),$(V)!=="svelte-1vuni30"&&(V.textContent=Se),me=o(e),c(E.$$.fragment,e),ce=o(e),c(K.$$.fragment,e),pe=o(e),a=d(e,"DIV",{class:!0});var l=_(a);c(k.$$.fragment,l),Le=o(l),q=d(l,"P",{"data-svelte-h":!0}),$(q)!=="svelte-kybnzt"&&(q.textContent=qe),He=o(l),U=d(l,"P",{"data-svelte-h":!0}),$(U)!=="svelte-1hyu2ru"&&(U.innerHTML=Ue),Ae=o(l),j=d(l,"DIV",{class:!0});var nt=_(j);c(J.$$.fragment,nt),nt.forEach(n),De=o(l),w=d(l,"DIV",{class:!0});var $e=_(w);c(M.$$.fragment,$e),Re=o($e),X=d($e,"P",{"data-svelte-h":!0}),$(X)!=="svelte-189cc7b"&&(X.innerHTML=je),$e.forEach(n),Ce=o(l),T=d(l,"DIV",{class:!0});var ve=_(T);c(Z.$$.fragment,ve),Ve=o(ve),B=d(ve,"P",{"data-svelte-h":!0}),$(B)!=="svelte-1f366pl"&&(B.innerHTML=Xe),ve.forEach(n),Ee=o(l),I=d(l,"DIV",{class:!0});var ye=_(I);c(O.$$.fragment,ye),Ke=o(ye),Y=d(ye,"P",{"data-svelte-h":!0}),$(Y)!=="svelte-14bnrb6"&&(Y.textContent=Be),ye.forEach(n),ke=o(l),L=d(l,"DIV",{class:!0});var xe=_(L);c(P.$$.fragment,xe),Je=o(xe),Q=d(xe,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-1xwrf7t"&&(Q.textContent=Ye),xe.forEach(n),Me=o(l),ee=d(l,"DIV",{class:!0});var rt=_(ee);c(W.$$.fragment,rt),rt.forEach(n),Ze=o(l),H=d(l,"DIV",{class:!0});var we=_(H);c(z.$$.fragment,we),Oe=o(we),te=d(we,"P",{"data-svelte-h":!0}),$(te)!=="svelte-1vrxp2b"&&(te.textContent=Qe),we.forEach(n),Pe=o(l),A=d(l,"DIV",{class:!0});var Te=_(A);c(G.$$.fragment,Te),We=o(Te),ne=d(Te,"P",{"data-svelte-h":!0}),$(ne)!=="svelte-1un5fcn"&&(ne.textContent=et),Te.forEach(n),l.forEach(n),fe=o(e),c(N.$$.fragment,e),ge=o(e),x=d(e,"DIV",{class:!0});var Ie=_(x);c(F.$$.fragment,Ie),ze=o(Ie),re=d(Ie,"P",{"data-svelte-h":!0}),$(re)!=="svelte-18u8upa"&&(re.textContent=tt),Ie.forEach(n),he=o(e),c(S.$$.fragment,e),_e=o(e),ae=d(e,"P",{}),_(ae).forEach(n),this.h()},h(){b(y,"name","hf:doc:metadata"),b(y,"content",ft),b(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(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,s){t(document.head,y),u(e,se,s),u(e,oe,s),u(e,ie,s),p(D,e,s),u(e,de,s),p(R,e,s),u(e,le,s),u(e,C,s),u(e,ue,s),u(e,V,s),u(e,me,s),p(E,e,s),u(e,ce,s),p(K,e,s),u(e,pe,s),u(e,a,s),p(k,a,null),t(a,Le),t(a,q),t(a,He),t(a,U),t(a,Ae),t(a,j),p(J,j,null),t(a,De),t(a,w),p(M,w,null),t(w,Re),t(w,X),t(a,Ce),t(a,T),p(Z,T,null),t(T,Ve),t(T,B),t(a,Ee),t(a,I),p(O,I,null),t(I,Ke),t(I,Y),t(a,ke),t(a,L),p(P,L,null),t(L,Je),t(L,Q),t(a,Me),t(a,ee),p(W,ee,null),t(a,Ze),t(a,H),p(z,H,null),t(H,Oe),t(H,te),t(a,Pe),t(a,A),p(G,A,null),t(A,We),t(A,ne),u(e,fe,s),p(N,e,s),u(e,ge,s),u(e,x,s),p(F,x,null),t(x,ze),t(x,re),u(e,he,s),p(S,e,s),u(e,_e,s),u(e,ae,s),be=!0},p:at,i(e){be||(f(D.$$.fragment,e),f(R.$$.fragment,e),f(E.$$.fragment,e),f(K.$$.fragment,e),f(k.$$.fragment,e),f(J.$$.fragment,e),f(M.$$.fragment,e),f(Z.$$.fragment,e),f(O.$$.fragment,e),f(P.$$.fragment,e),f(W.$$.fragment,e),f(z.$$.fragment,e),f(G.$$.fragment,e),f(N.$$.fragment,e),f(F.$$.fragment,e),f(S.$$.fragment,e),be=!0)},o(e){g(D.$$.fragment,e),g(R.$$.fragment,e),g(E.$$.fragment,e),g(K.$$.fragment,e),g(k.$$.fragment,e),g(J.$$.fragment,e),g(M.$$.fragment,e),g(Z.$$.fragment,e),g(O.$$.fragment,e),g(P.$$.fragment,e),g(W.$$.fragment,e),g(z.$$.fragment,e),g(G.$$.fragment,e),g(N.$$.fragment,e),g(F.$$.fragment,e),g(S.$$.fragment,e),be=!1},d(e){e&&(n(se),n(oe),n(ie),n(de),n(le),n(C),n(ue),n(V),n(me),n(ce),n(pe),n(a),n(fe),n(ge),n(x),n(he),n(_e),n(ae)),n(y),h(D,e),h(R,e),h(E,e),h(K,e),h(k),h(J),h(M),h(Z),h(O),h(P),h(W),h(z),h(G),h(N,e),h(F),h(S,e)}}}const ft='{"title":"AutoencoderKLHunyuanImageRefiner","local":"autoencoderklhunyuanimagerefiner","sections":[{"title":"AutoencoderKLHunyuanImageRefiner","local":"diffusers.AutoencoderKLHunyuanImageRefiner","sections":[],"depth":2},{"title":"DecoderOutput","local":"diffusers.models.autoencoders.vae.DecoderOutput","sections":[],"depth":2}],"depth":1}';function gt(Ne){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xt extends it{constructor(y){super(),dt(this,y,gt,pt,ot,{})}}export{xt as component};
