Buckets:

download
raw
14 kB
import"../chunks/DsnmJJEf.js";import{i as V,h as W,C as N,H as m,a as z,D as o,E as G,s as M}from"../chunks/BtE7mKSK.js";import{p as E,o as F,s as e,f as U,a as I,b as q,c as n,d as w,n as r,r as t}from"../chunks/jDjavuwI.js";const C='{"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}';var S=w('<meta name="hf:doc:metadata"/>'),j=w(`<p></p> <!> <!> <p>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.</p> <p>The model can be loaded with the following code snippet.</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>A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. Used for
HunyuanImage-2.1 Refiner.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14178/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).</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>Decode a batch of images.</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>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.</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>Encode a batch of images into latents.</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"><!></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>Decode a batch of images using a tiled decoder.</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>Encode a batch of images using a tiled encoder.</p></div></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>Output of decoding method.</p></div> <!> <p></p>`,1);function P(L,H){E(H,!1),F(()=>{new URLSearchParams(window.location.search).get("fw")}),V();var p=j();W("1qvozsc",T=>{var x=S();M(x,"content",C),I(T,x)});var f=e(U(p),2);N(f,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var h=e(f,2);m(h,{title:"AutoencoderKLHunyuanImageRefiner",local:"autoencoderklhunyuanimagerefiner",headingTag:"h1"});var g=e(h,6);z(g,{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)`,lang:"python",wrap:!1});var _=e(g,2);m(_,{title:"AutoencoderKLHunyuanImageRefiner",local:"diffusers.AutoencoderKLHunyuanImageRefiner",headingTag:"h2"});var a=e(_,2),v=n(a);o(v,{name:"class diffusers.AutoencoderKLHunyuanImageRefiner",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L593",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"latent_channels",val:": int = 32"},{name:"block_out_channels",val:": tuple = (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"}]});var d=e(v,6),A=n(d);o(A,{name:"decode",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L743",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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"}],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>
`}),r(2),t(d);var i=e(d,2),R=n(i);o(R,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L662",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"},{name:"tile_overlap_factor",val:": float | None = 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"}]}),r(2),t(i);var s=e(i,2),D=n(s);o(D,{name:"encode",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L703",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of images.",name:"x"},{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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"}],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>
`}),r(2),t(s);var c=e(s,2),K=n(c);o(K,{name:"forward",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L897",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch.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"},{anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.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"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> 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>
`}),t(c);var u=e(c,2),k=n(u);o(k,{name:"tiled_decode",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.tiled_decode",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L843",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"}],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>
`}),r(2),t(u);var b=e(u,2),J=n(b);o(J,{name:"tiled_encode",anchor:"diffusers.AutoencoderKLHunyuanImageRefiner.tiled_encode",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py#L793",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"}],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>
`}),r(2),t(b),t(a);var y=e(a,2);m(y,{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"});var l=e(y,2),O=n(l);o(O,{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14178/src/diffusers/models/autoencoders/vae.py#L46",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"}]}),r(2),t(l);var Z=e(l,2);G(Z,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_hunyuanimage_refiner.md"}),r(2),I(L,p),q()}export{P as component};

Xet Storage Details

Size:
14 kB
·
Xet hash:
40d5b4936c486c3e79040eb4672adcbaf29465ad00f957ed798abe2e64b67b80

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