Buckets:

download
raw
10.7 kB
import"../chunks/DsnmJJEf.js";import{i as y,h as w,C as z,H as b,a as D,D as o,E as M,s as I}from"../chunks/BtE7mKSK.js";import{p as j,o as J,s as e,f as W,a as v,b as O,c as t,d as A,n,r}from"../chunks/jDjavuwI.js";const Z='{"title":"AutoencoderKLKVAE","local":"autoencoderklkvae","sections":[{"title":"AutoencoderKLKVAE","local":"diffusers.AutoencoderKLKVAE","sections":[],"depth":2}],"depth":1}';var G=A('<meta name="hf:doc:metadata"/>'),R=A(`<p></p> <!> <!> <p>The 2D variational autoencoder (VAE) model with KL loss.</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 images into latents and decoding latent representations into images.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14261/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for its 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"><!></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> <!> <p></p>`,1);function X(K,x){j(x,!1),J(()=>{new URLSearchParams(window.location.search).get("fw")}),y();var i=R();w("1dcykmq",g=>{var _=G();I(_,"content",Z),v(g,_)});var l=e(W(i),2);z(l,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var u=e(l,2);b(u,{title:"AutoencoderKLKVAE",local:"autoencoderklkvae",headingTag:"h1"});var p=e(u,6);D(p,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTEtWQUUlMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMS1ZBRS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5bGFiJTJGS1ZBRS0yRC0xLjAlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJkaWZmdXNlcnMlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLKVAE
vae = AutoencoderKLKVAE.from_pretrained(<span class="hljs-string">&quot;kandinskylab/KVAE-2D-1.0&quot;</span>, subfolder=<span class="hljs-string">&quot;diffusers&quot;</span>, torch_dtype=torch.bfloat16)`,lang:"python",wrap:!1});var m=e(p,2);b(m,{title:"AutoencoderKLKVAE",local:"diffusers.AutoencoderKLKVAE",headingTag:"h2"});var d=e(m,2),f=t(d);o(f,{name:"class diffusers.AutoencoderKLKVAE",anchor:"diffusers.AutoencoderKLKVAE",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/autoencoders/autoencoder_kl_kvae.py#L521",parameters:[{name:"in_channels",val:": int = 3"},{name:"channels",val:": int = 128"},{name:"num_enc_blocks",val:": int = 2"},{name:"num_dec_blocks",val:": int = 2"},{name:"z_channels",val:": int = 16"},{name:"double_z",val:": bool = True"},{name:"ch_mult",val:": typing.Tuple[int, ...] = (1, 2, 4, 8)"},{name:"sample_size",val:": int = 1024"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLKVAE.in_channels",description:"<strong>in_channels</strong> (int, <em>optional</em>, defaults to 3) &#x2014; Number of channels in the input image.",name:"in_channels"},{anchor:"diffusers.AutoencoderKLKVAE.channels",description:"<strong>channels</strong> (int, <em>optional</em>, defaults to 128) &#x2014; The base number of channels in multiresolution blocks.",name:"channels"},{anchor:"diffusers.AutoencoderKLKVAE.num_enc_blocks",description:`<strong>num_enc_blocks</strong> (int, <em>optional</em>, defaults to 2) &#x2014;
The number of Resnet blocks in encoder multiresolution layers.`,name:"num_enc_blocks"},{anchor:"diffusers.AutoencoderKLKVAE.num_dec_blocks",description:`<strong>num_dec_blocks</strong> (int, <em>optional</em>, defaults to 2) &#x2014;
The number of Resnet blocks in decoder multiresolution layers.`,name:"num_dec_blocks"},{anchor:"diffusers.AutoencoderKLKVAE.z_channels",description:"<strong>z_channels</strong> (int, <em>optional</em>, defaults to 16) &#x2014; Number of channels in the latent space.",name:"z_channels"},{anchor:"diffusers.AutoencoderKLKVAE.double_z",description:`<strong>double_z</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to double the number of output channels of encoder.`,name:"double_z"},{anchor:"diffusers.AutoencoderKLKVAE.ch_mult",description:`<strong>ch_mult</strong> (<code>Tuple[int, ...]</code>, <em>optional</em>, default to <code>(1, 2, 4, 8)</code>) &#x2014;
The channel multipliers in multiresolution blocks.`,name:"ch_mult"},{anchor:"diffusers.AutoencoderKLKVAE.sample_size",description:"<strong>sample_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1024</code>) &#x2014; Sample input size.",name:"sample_size"}]});var s=e(f,6),L=t(s);o(L,{name:"decode",anchor:"diffusers.AutoencoderKLKVAE.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/autoencoders/autoencoder_kl_kvae.py#L642",parameters:[{name:"z",val:": FloatTensor"},{name:"return_dict",val:": bool = True"},{name:"generator",val:" = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLKVAE.decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLKVAE.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 a=e(s,2),k=t(a);o(k,{name:"encode",anchor:"diffusers.AutoencoderKLKVAE.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/autoencoders/autoencoder_kl_kvae.py#L602",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLKVAE.encode.x",description:"<strong>x</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of images.",name:"x"},{anchor:"diffusers.AutoencoderKLKVAE.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 images. 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(a);var c=e(a,2),T=t(c);o(T,{name:"forward",anchor:"diffusers.AutoencoderKLKVAE.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/autoencoders/autoencoder_kl_kvae.py#L776",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.AutoencoderKLKVAE.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLKVAE.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.AutoencoderKLKVAE.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.AutoencoderKLKVAE.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(c);var h=e(c,2),E=t(h);o(E,{name:"tiled_decode",anchor:"diffusers.AutoencoderKLKVAE.tiled_decode",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/autoencoders/autoencoder_kl_kvae.py#L729",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLKVAE.tiled_decode.z",description:"<strong>z</strong> (<code>torch.Tensor</code>) &#x2014; Input batch of latent vectors.",name:"z"},{anchor:"diffusers.AutoencoderKLKVAE.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(h),r(d);var V=e(d,2);M(V,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoder_kl_kvae.md"}),n(2),v(K,i),O()}export{X as component};

Xet Storage Details

Size:
10.7 kB
·
Xet hash:
d48cf0d46a1a74950354c1b1225743732de35ec257c97dda1482e4623976ebd3

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