Buckets:

download
raw
14.5 kB
import"../chunks/DsnmJJEf.js";import{i as N,h as W,C as Z,H as d,a as j,D as o,E as R,s as C}from"../chunks/CmJXCtRL.js";import{p as V,o as F,s as e,f as J,a as A,b as S,c as t,d as I,n,r}from"../chunks/DK803DsY.js";const H='{"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}';var B=I('<meta name="hf:doc:metadata"/>'),Y=I(`<p></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.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14407/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>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"><!> <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"><!></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 AutoencoderKL encoding 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>Output of decoding method.</p></div> <!> <p></p>`,1);function ee(K,D){V(D,!1),F(()=>{new URLSearchParams(window.location.search).get("fw")}),N();var g=Y();W("1ldnp6",T=>{var y=B();C(y,"content",H),A(T,y)});var h=e(J(g),2);Z(h,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var f=e(h,2);d(f,{title:"AutoencoderKLQwenImage",local:"autoencoderklqwenimage",headingTag:"h1"});var _=e(f,4);j(_,{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});var v=e(_,2);d(v,{title:"AutoencoderKLQwenImage",local:"diffusers.AutoencoderKLQwenImage",headingTag:"h2"});var a=e(v,2),b=t(a);o(b,{name:"class diffusers.AutoencoderKLQwenImage",anchor:"diffusers.AutoencoderKLQwenImage",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L673",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]"}]});var s=e(b,6),Q=t(s);o(Q,{name:"decode",anchor:"diffusers.AutoencoderKLQwenImage.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L866",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"}],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>
`}),n(2),r(s);var i=e(s,2),O=t(i);o(O,{name:"encode",anchor:"diffusers.AutoencoderKLQwenImage.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L814",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"}],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>
`}),n(2),r(i);var c=e(i,2),k=t(c);o(k,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLQwenImage.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L744",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"}]}),n(2),r(c);var l=e(c,2),M=t(l);o(M,{name:"forward",anchor:"diffusers.AutoencoderKLQwenImage.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L1036",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.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"}],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>
`}),r(l);var u=e(l,2),q=t(u);o(q,{name:"tiled_decode",anchor:"diffusers.AutoencoderKLQwenImage.tiled_decode",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L973",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"}],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>
`}),n(2),r(u);var w=e(u,2),G=t(w);o(G,{name:"tiled_encode",anchor:"diffusers.AutoencoderKLQwenImage.tiled_encode",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage.py#L907",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"}],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(2),r(w),r(a);var x=e(a,2);d(x,{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"});var m=e(x,2),E=t(m);o(E,{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14407/src/diffusers/models/modeling_outputs.py#L7",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"}]}),n(2),r(m);var L=e(m,2);d(L,{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"});var p=e(L,2),U=t(p);o(U,{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14407/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"}]}),n(2),r(p);var z=e(p,2);R(z,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_qwenimage.md"}),n(2),A(K,g),S()}export{ee as component};

Xet Storage Details

Size:
14.5 kB
·
Xet hash:
d975ce29217ea8915890f9b48e7eeff546fd68a4055038f8fa2eb32b16890afe

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