Buckets:
| import"../chunks/DsnmJJEf.js";import{i as E,h as Z,C as F,H as a,a as j,D as o,E as G,s as V}from"../chunks/BLbO27j4.js";import{p as B,o as X,s as e,f as H,a as A,b as C,c as t,d as D,n as r,r as n}from"../chunks/jDjavuwI.js";const R='{"title":"AutoencoderKLQwenImage21","local":"autoencoderklqwenimage21","sections":[{"title":"AutoencoderKLQwenImage21","local":"diffusers.AutoencoderKLQwenImage21","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 S=D('<meta name="hf:doc:metadata"/>'),U=D(`<p></p> <!> <!> <p>The 64-channel variational auto-encoder used by Qwen-Image 2.1. It compresses 16x spatially, and its per-channel <code>latents_mean</code> / <code>latents_std</code> are part of the config rather than a single scaling factor.</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. | |
| Introduced in [Qwen Image 2].</p> <p>This model inherits from <a href="/docs/diffusers/pr_14921/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,y){B(y,!1),X(()=>{new URLSearchParams(window.location.search).get("fw")}),E();var g=U();Z("nfqv89",L=>{var I=S();V(I,"content",R),A(L,I)});var f=e(H(g),2);F(f,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var h=e(f,2);a(h,{title:"AutoencoderKLQwenImage21",local:"autoencoderklqwenimage21",headingTag:"h1"});var _=e(h,4);j(_,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFF3ZW5JbWFnZTIxJTBBJTBBdmFlJTIwJTNEJTIwQXV0b2VuY29kZXJLTFF3ZW5JbWFnZTIxLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbi1JbWFnZS0yLjElMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjBkdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLQwenImage21 | |
| vae = AutoencoderKLQwenImage21.from_pretrained(<span class="hljs-string">"Qwen/Qwen-Image-2.1"</span>, subfolder=<span class="hljs-string">"vae"</span>, dtype=torch.bfloat16)`,lang:"python",wrap:!1});var v=e(_,2);a(v,{title:"AutoencoderKLQwenImage21",local:"diffusers.AutoencoderKLQwenImage21",headingTag:"h2"});var d=e(v,2),b=t(d);o(b,{name:"class diffusers.AutoencoderKLQwenImage21",anchor:"diffusers.AutoencoderKLQwenImage21",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L977",parameters:[{name:"base_dim",val:": int = 96"},{name:"decoder_base_dim",val:": int | None = 144"},{name:"z_dim",val:": int = 64"},{name:"dim_mult",val:": list = [1, 2, 4, 8, 8]"},{name:"num_res_blocks",val:": int = 2"},{name:"attn_scales",val:": list = []"},{name:"temperal_downsample",val:": list = [False, True, True, True]"},{name:"dropout",val:": float = 0.0"},{name:"latents_mean",val:": list = [0.5126, 0.7721, -0.0631, 1.3506, -0.7855, -2.1025, -0.3458, 1.3722, 1.8873, -1.7177, -0.651, 0.2732, 0.7562, -0.6163, -1.0277, 3.8363, 2.021, 0.0472, 0.932, 2.0087, 2.4954, -0.1391, -1.4249, 1.8464, -0.5236, 1.2826, 3.7046, -1.3035, 2.7286, -1.4518, -1.9036, -1.9955, -0.0342, -1.0265, -0.7636, 3.0555, 0.0746, -3.0751, -0.1076, 1.7376, -1.0914, -1.9435, -0.2784, -1.368, 0.4809, -0.4433, 0.3764, 0.5729, -2.0595, 1.096, -1.326, -2.0211, -5.0179, 0.5275, 4.0162, 1.8505, 0.3026, 1.9373, 1.4937, 0.2632, 0.5547, -1.7121, -0.1562, 0.0304]"},{name:"latents_std",val:": list = [3.2001, 3.2936, 3.4321, 3.0091, 3.1061, 4.0379, 4.0705, 3.791, 3.0785, 3.65, 3.9308, 3.0904, 2.8778, 3.7675, 3.732, 5.0756, 3.2864, 4.0397, 3.1317, 4.0443, 2.9249, 3.9454, 3.0988, 4.2489, 3.4896, 3.8513, 3.9323, 3.4719, 3.7498, 4.283, 3.5694, 4.2467, 3.9037, 3.2947, 5.077, 3.5075, 3.27, 3.4767, 2.8063, 5.1125, 3.5327, 4.7833, 3.1286, 4.1819, 3.8527, 3.8312, 3.5605, 4.3875, 3.9624, 4.0168, 3.5643, 4.055, 5.5614, 4.2963, 4.408, 3.4959, 3.8747, 3.7608, 3.5735, 3.149, 3.7662, 3.6746, 3.4563, 3.8161]"},{name:"is_residual",val:": bool = True"},{name:"in_channels",val:": int = 4"},{name:"out_channels",val:": int = 4"},{name:"patch_size",val:": int | None = None"},{name:"scale_factor_temporal",val:": int | None = 8"},{name:"scale_factor_spatial",val:": int | None = 16"}]});var s=e(b,6),Q=t(s);o(Q,{name:"decode",anchor:"diffusers.AutoencoderKLQwenImage21.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L1336",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage21.decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) — Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLQwenImage21.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| 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),n(s);var i=e(s,2),O=t(i);o(O,{name:"encode",anchor:"diffusers.AutoencoderKLQwenImage21.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L1276",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage21.encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) — Input batch of images.",name:"x"},{anchor:"diffusers.AutoencoderKLQwenImage21.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| 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),n(i);var c=e(i,2),k=t(c);o(k,{name:"enable_tiling",anchor:"diffusers.AutoencoderKLQwenImage21.enable_tiling",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L1207",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.AutoencoderKLQwenImage21.enable_tiling.tile_sample_min_height",description:`<strong>tile_sample_min_height</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum height required for a sample to be separated into tiles across the height dimension.`,name:"tile_sample_min_height"},{anchor:"diffusers.AutoencoderKLQwenImage21.enable_tiling.tile_sample_min_width",description:`<strong>tile_sample_min_width</strong> (<code>int</code>, <em>optional</em>) — | |
| The minimum width required for a sample to be separated into tiles across the width dimension.`,name:"tile_sample_min_width"},{anchor:"diffusers.AutoencoderKLQwenImage21.enable_tiling.tile_sample_stride_height",description:`<strong>tile_sample_stride_height</strong> (<code>int</code>, <em>optional</em>) — | |
| 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.AutoencoderKLQwenImage21.enable_tiling.tile_sample_stride_width",description:`<strong>tile_sample_stride_width</strong> (<code>int</code>, <em>optional</em>) — | |
| 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),n(c);var l=e(c,2),J=t(l);o(J,{name:"forward",anchor:"diffusers.AutoencoderKLQwenImage21.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L1532",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.AutoencoderKLQwenImage21.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) — Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLQwenImage21.forward.sample_posterior",description:`<strong>sample_posterior</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to sample from the posterior instead of taking its mode.`,name:"sample_posterior"},{anchor:"diffusers.AutoencoderKLQwenImage21.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>DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.AutoencoderKLQwenImage21.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| Generator used when <code>sample_posterior</code> is <code>True</code>.`,name:"generator"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14921/en/api/models/autoencoderkl_qwenimage21#diffusers.models.autoencoders.vae.DecoderOutput" | |
| >DecoderOutput</a> if <code>return_dict</code> is True, otherwise a plain <code>tuple</code>.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14921/en/api/models/autoencoderkl_qwenimage21#diffusers.models.autoencoders.vae.DecoderOutput" | |
| >DecoderOutput</a> or <code>tuple</code></p> | |
| `}),n(l);var u=e(l,2),q=t(u);o(q,{name:"tiled_decode",anchor:"diffusers.AutoencoderKLQwenImage21.tiled_decode",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L1454",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage21.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) — Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLQwenImage21.tiled_decode.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.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),n(u);var w=e(u,2),M=t(w);o(M,{name:"tiled_encode",anchor:"diffusers.AutoencoderKLQwenImage21.tiled_encode",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/autoencoder_kl_qwenimage21.py#L1381",parameters:[{name:"x",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLQwenImage21.tiled_encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) — 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),n(w),n(d);var T=e(d,2);a(T,{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"});var m=e(T,2),z=t(m);o(z,{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14921/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>) — | |
| 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"}]}),r(2),n(m);var x=e(m,2);a(x,{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"});var p=e(x,2),N=t(p);o(N,{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14921/src/diffusers/models/autoencoders/vae.py#L49",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>) — | |
| The decoded output sample from the last layer of the model.`,name:"sample"}]}),r(2),n(p);var W=e(p,2);G(W,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_qwenimage21.md"}),r(2),A(K,g),C()}export{ee as component}; | |
Xet Storage Details
- Size:
- 16.1 kB
- Xet hash:
- 7c71fbd67f7a22c7c649c3475236efa1dd16a8200d57ed706e69451e4b6fe0c4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.