import{S as go,i as yo,s as vo,e as n,k as c,w as f,t as m,M as bo,c as a,d as t,m as d,a as s,x as h,h as u,b as r,G as o,g as l,y as g,L as _o,q as y,o as v,B as b,v as wo}from"../../../chunks/vendor-hf-doc-builder.js";import{D as He}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as Ao}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as le}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function ko(Zt){let _,Te,w,J,ce,V,et,de,tt,Me,E,ot,K,nt,at,Ue,oe,st,xe,ne,ae,rt,j,it,Je,se,lt,Ee,A,L,me,Q,ct,ue,dt,Le,N,pe,B,mt,ut,fe,I,pt,Ne,k,G,he,z,ft,ge,ht,Ge,Y,Se,$,S,ye,C,gt,ve,yt,We,p,F,vt,R,bt,O,_t,wt,At,q,kt,re,$t,Tt,Mt,ie,X,Ze,T,W,be,P,Ut,_e,xt,De,M,H,Jt,we,Et,Ve,U,Z,Ae,ee,Lt,ke,Nt,Ke,x,te,Gt,$e,St,je;return V=new le({}),Q=new le({}),z=new le({}),Y=new Ao({props:{code:"ZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEFzeW1tZXRyaWNBdXRvZW5jb2RlcktMJTJDJTIwU3RhYmxlRGlmZnVzaW9uSW5wYWludFBpcGVsaW5lJTBBJTBBJTBBZGVmJTIwZG93bmxvYWRfaW1hZ2UodXJsJTNBJTIwc3RyKSUyMC0lM0UlMjBJbWFnZS5JbWFnZSUzQSUwQSUyMCUyMCUyMCUyMHJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBwaG90byUyMG9mJTIwYSUyMHBlcnNvbiUyMiUwQWltZ191cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGcmVwYWludCUyRmNlbGViYV9ocV8yNTYucG5nJTIyJTBBbWFza191cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGcmVwYWludCUyRm1hc2tfMjU2LnBuZyUyMiUwQSUwQWltYWdlJTIwJTNEJTIwZG93bmxvYWRfaW1hZ2UoaW1nX3VybCkucmVzaXplKCgyNTYlMkMlMjAyNTYpKSUwQW1hc2tfaW1hZ2UlMjAlM0QlMjBkb3dubG9hZF9pbWFnZShtYXNrX3VybCkucmVzaXplKCgyNTYlMkMlMjAyNTYpKSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi1pbnBhaW50aW5nJTIyKSUwQXBpcGUudmFlJTIwJTNEJTIwQXN5bW1ldHJpY0F1dG9lbmNvZGVyS0wuZnJvbV9wcmV0cmFpbmVkKCUyMmNyb3NzLWF0dGVudGlvbiUyRmFzeW1tZXRyaWMtYXV0b2VuY29kZXIta2wteC0xLTUlMjIpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2tfaW1hZ2UpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmltYWdlLmpwZWclMjIp",highlighted:`<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AsymmetricAutoencoderKL, StableDiffusionInpaintPipeline


<span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url: <span class="hljs-built_in">str</span></span>) -&gt; Image.Image:
    response = requests.get(url)
    <span class="hljs-keyword">return</span> Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)


prompt = <span class="hljs-string">&quot;a photo of a person&quot;</span>
img_url = <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/repaint/celeba_hq_256.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/repaint/mask_256.png&quot;</span>

image = download_image(img_url).resize((<span class="hljs-number">256</span>, <span class="hljs-number">256</span>))
mask_image = download_image(mask_url).resize((<span class="hljs-number">256</span>, <span class="hljs-number">256</span>))

pipe = StableDiffusionInpaintPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-inpainting&quot;</span>)
pipe.vae = AsymmetricAutoencoderKL.from_pretrained(<span class="hljs-string">&quot;cross-attention/asymmetric-autoencoder-kl-x-1-5&quot;</span>)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe(prompt=prompt, image=image, mask_image=mask_image).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;image.jpeg&quot;</span>)`}}),C=new le({}),F=new He({props:{name:"class diffusers.AsymmetricAutoencoderKL",anchor:"diffusers.AsymmetricAutoencoderKL",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"down_block_types",val:": typing.Tuple[str] = ('DownEncoderBlock2D',)"},{name:"down_block_out_channels",val:": typing.Tuple[int] = (64,)"},{name:"layers_per_down_block",val:": int = 1"},{name:"up_block_types",val:": typing.Tuple[str] = ('UpDecoderBlock2D',)"},{name:"up_block_out_channels",val:": typing.Tuple[int] = (64,)"},{name:"layers_per_up_block",val:": int = 1"},{name:"act_fn",val:": str = 'silu'"},{name:"latent_channels",val:": int = 4"},{name:"norm_num_groups",val:": int = 32"},{name:"sample_size",val:": int = 32"},{name:"scaling_factor",val:": float = 0.18215"}],parametersDescription:[{anchor:"diffusers.AsymmetricAutoencoderKL.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.AsymmetricAutoencoderKL.out_channels",description:"<strong>out_channels</strong> (int,  <em>optional</em>, defaults to 3) &#x2014; Number of channels in the output.",name:"out_channels"},{anchor:"diffusers.AsymmetricAutoencoderKL.down_block_types",description:`<strong>down_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;DownEncoderBlock2D&quot;,)</code>) &#x2014;
Tuple of downsample block types.`,name:"down_block_types"},{anchor:"diffusers.AsymmetricAutoencoderKL.down_block_out_channels",description:`<strong>down_block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(64,)</code>) &#x2014;
Tuple of down block output channels.`,name:"down_block_out_channels"},{anchor:"diffusers.AsymmetricAutoencoderKL.layers_per_down_block",description:`<strong>layers_per_down_block</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1</code>) &#x2014;
Number layers for down block.`,name:"layers_per_down_block"},{anchor:"diffusers.AsymmetricAutoencoderKL.up_block_types",description:`<strong>up_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;UpDecoderBlock2D&quot;,)</code>) &#x2014;
Tuple of upsample block types.`,name:"up_block_types"},{anchor:"diffusers.AsymmetricAutoencoderKL.up_block_out_channels",description:`<strong>up_block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(64,)</code>) &#x2014;
Tuple of up block output channels.`,name:"up_block_out_channels"},{anchor:"diffusers.AsymmetricAutoencoderKL.layers_per_up_block",description:`<strong>layers_per_up_block</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1</code>) &#x2014;
Number layers for up block.`,name:"layers_per_up_block"},{anchor:"diffusers.AsymmetricAutoencoderKL.act_fn",description:"<strong>act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014; The activation function to use.",name:"act_fn"},{anchor:"diffusers.AsymmetricAutoencoderKL.latent_channels",description:"<strong>latent_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; Number of channels in the latent space.",name:"latent_channels"},{anchor:"diffusers.AsymmetricAutoencoderKL.sample_size",description:"<strong>sample_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) &#x2014; Sample input size.",name:"sample_size"},{anchor:"diffusers.AsymmetricAutoencoderKL.norm_num_groups",description:`<strong>norm_num_groups</strong> (<code>int</code>, <em>optional</em>, defaults to <code>32</code>) &#x2014;
Number of groups to use for the first normalization layer in ResNet blocks.`,name:"norm_num_groups"},{anchor:"diffusers.AsymmetricAutoencoderKL.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.18215) &#x2014;
The component-wise standard deviation of the trained latent space computed using the first batch of the
training set. This is used to scale the latent space to have unit variance when training the diffusion
model. The latents are scaled with the formula <code>z = z * scaling_factor</code> before being passed to the
diffusion model. When decoding, the latents are scaled back to the original scale with the formula: <code>z = 1 / scaling_factor * z</code>. For more details, refer to sections 4.3.2 and D.1 of the <a href="https://arxiv.org/abs/2112.10752" rel="nofollow">High-Resolution Image
Synthesis with Latent Diffusion Models</a> paper.`,name:"scaling_factor"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/models/autoencoder_asym_kl.py#L26"}}),X=new He({props:{name:"forward",anchor:"diffusers.AsymmetricAutoencoderKL.forward",parameters:[{name:"sample",val:": FloatTensor"},{name:"mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AsymmetricAutoencoderKL.forward.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AsymmetricAutoencoderKL.forward.mask",description:"<strong>mask</strong> (<code>torch.FloatTensor</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014; Optional inpainting mask.",name:"mask"},{anchor:"diffusers.AsymmetricAutoencoderKL.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.AsymmetricAutoencoderKL.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/v0.20.0/src/diffusers/models/autoencoder_asym_kl.py#L152"}}),P=new le({}),H=new He({props:{name:"class diffusers.models.autoencoder_kl.AutoencoderKLOutput",anchor:"diffusers.models.autoencoder_kl.AutoencoderKLOutput",parameters:[{name:"latent_dist",val:": DiagonalGaussianDistribution"}],parametersDescription:[{anchor:"diffusers.models.autoencoder_kl.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"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/models/autoencoder_kl.py#L29"}}),ee=new le({}),te=new He({props:{name:"class diffusers.models.vae.DecoderOutput",anchor:"diffusers.models.vae.DecoderOutput",parameters:[{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.models.vae.DecoderOutput.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</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/v0.20.0/src/diffusers/models/vae.py#L28"}}),{c(){_=n("meta"),Te=c(),w=n("h1"),J=n("a"),ce=n("span"),f(V.$$.fragment),et=c(),de=n("span"),tt=m("AsymmetricAutoencoderKL"),Me=c(),E=n("p"),ot=m("Improved larger variational autoencoder (VAE) model with KL loss for inpainting task: "),K=n("a"),nt=m("Designing a Better Asymmetric VQGAN for StableDiffusion"),at=m(" by Zixin Zhu, Xuelu Feng, Dongdong Chen, Jianmin Bao, Le Wang, Yinpeng Chen, Lu Yuan, Gang Hua."),Ue=c(),oe=n("p"),st=m("The abstract from the paper is:"),xe=c(),ne=n("p"),ae=n("em"),rt=m("StableDiffusion is a revolutionary text-to-image generator that is causing a stir in the world of image generation and editing. Unlike traditional methods that learn a diffusion model in pixel space, StableDiffusion learns a diffusion model in the latent space via a VQGAN, ensuring both efficiency and quality. It not only supports image generation tasks, but also enables image editing for real images, such as image inpainting and local editing. However, we have observed that the vanilla VQGAN used in StableDiffusion leads to significant information loss, causing distortion artifacts even in non-edited image regions. To this end, we propose a new asymmetric VQGAN with two simple designs. Firstly, in addition to the input from the encoder, the decoder contains a conditional branch that incorporates information from task-specific priors, such as the unmasked image region in inpainting. Secondly, the decoder is much heavier than the encoder, allowing for more detailed recovery while only slightly increasing the total inference cost. The training cost of our asymmetric VQGAN is cheap, and we only need to retrain a new asymmetric decoder while keeping the vanilla VQGAN encoder and StableDiffusion unchanged. Our asymmetric VQGAN can be widely used in StableDiffusion-based inpainting and local editing methods. Extensive experiments demonstrate that it can significantly improve the inpainting and editing performance, while maintaining the original text-to-image capability. The code is available at "),j=n("a"),it=m("https://github.com/buxiangzhiren/Asymmetric_VQGAN"),Je=c(),se=n("p"),lt=m("Evaluation results can be found in section 4.1 of the original paper."),Ee=c(),A=n("h2"),L=n("a"),me=n("span"),f(Q.$$.fragment),ct=c(),ue=n("span"),dt=m("Available checkpoints"),Le=c(),N=n("ul"),pe=n("li"),B=n("a"),mt=m("https://huggingface.co/cross-attention/asymmetric-autoencoder-kl-x-1-5"),ut=c(),fe=n("li"),I=n("a"),pt=m("https://huggingface.co/cross-attention/asymmetric-autoencoder-kl-x-2"),Ne=c(),k=n("h2"),G=n("a"),he=n("span"),f(z.$$.fragment),ft=c(),ge=n("span"),ht=m("Example Usage"),Ge=c(),f(Y.$$.fragment),Se=c(),$=n("h2"),S=n("a"),ye=n("span"),f(C.$$.fragment),gt=c(),ve=n("span"),yt=m("AsymmetricAutoencoderKL"),We=c(),p=n("div"),f(F.$$.fragment),vt=c(),R=n("p"),bt=m("Designing a Better Asymmetric VQGAN for StableDiffusion "),O=n("a"),_t=m("https://arxiv.org/abs/2306.04632"),wt=m(` . A VAE model with KL loss
for encoding images into latents and decoding latent representations into images.`),At=c(),q=n("p"),kt=m("This model inherits from "),re=n("a"),$t=m("ModelMixin"),Tt=m(`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),Mt=c(),ie=n("div"),f(X.$$.fragment),Ze=c(),T=n("h2"),W=n("a"),be=n("span"),f(P.$$.fragment),Ut=c(),_e=n("span"),xt=m("AutoencoderKLOutput"),De=c(),M=n("div"),f(H.$$.fragment),Jt=c(),we=n("p"),Et=m("Output of AutoencoderKL encoding method."),Ve=c(),U=n("h2"),Z=n("a"),Ae=n("span"),f(ee.$$.fragment),Lt=c(),ke=n("span"),Nt=m("DecoderOutput"),Ke=c(),x=n("div"),f(te.$$.fragment),Gt=c(),$e=n("p"),St=m("Output of decoding method."),this.h()},l(e){const i=bo('[data-svelte="svelte-1phssyn"]',document.head);_=a(i,"META",{name:!0,content:!0}),i.forEach(t),Te=d(e),w=a(e,"H1",{class:!0});var Qe=s(w);J=a(Qe,"A",{id:!0,class:!0,href:!0});var Dt=s(J);ce=a(Dt,"SPAN",{});var Vt=s(ce);h(V.$$.fragment,Vt),Vt.forEach(t),Dt.forEach(t),et=d(Qe),de=a(Qe,"SPAN",{});var Kt=s(de);tt=u(Kt,"AsymmetricAutoencoderKL"),Kt.forEach(t),Qe.forEach(t),Me=d(e),E=a(e,"P",{});var Be=s(E);ot=u(Be,"Improved larger variational autoencoder (VAE) model with KL loss for inpainting task: "),K=a(Be,"A",{href:!0,rel:!0});var jt=s(K);nt=u(jt,"Designing a Better Asymmetric VQGAN for StableDiffusion"),jt.forEach(t),at=u(Be," by Zixin Zhu, Xuelu Feng, Dongdong Chen, Jianmin Bao, Le Wang, Yinpeng Chen, Lu Yuan, Gang Hua."),Be.forEach(t),Ue=d(e),oe=a(e,"P",{});var Qt=s(oe);st=u(Qt,"The abstract from the paper is:"),Qt.forEach(t),xe=d(e),ne=a(e,"P",{});var Bt=s(ne);ae=a(Bt,"EM",{});var Wt=s(ae);rt=u(Wt,"StableDiffusion is a revolutionary text-to-image generator that is causing a stir in the world of image generation and editing. Unlike traditional methods that learn a diffusion model in pixel space, StableDiffusion learns a diffusion model in the latent space via a VQGAN, ensuring both efficiency and quality. It not only supports image generation tasks, but also enables image editing for real images, such as image inpainting and local editing. However, we have observed that the vanilla VQGAN used in StableDiffusion leads to significant information loss, causing distortion artifacts even in non-edited image regions. To this end, we propose a new asymmetric VQGAN with two simple designs. Firstly, in addition to the input from the encoder, the decoder contains a conditional branch that incorporates information from task-specific priors, such as the unmasked image region in inpainting. Secondly, the decoder is much heavier than the encoder, allowing for more detailed recovery while only slightly increasing the total inference cost. The training cost of our asymmetric VQGAN is cheap, and we only need to retrain a new asymmetric decoder while keeping the vanilla VQGAN encoder and StableDiffusion unchanged. Our asymmetric VQGAN can be widely used in StableDiffusion-based inpainting and local editing methods. Extensive experiments demonstrate that it can significantly improve the inpainting and editing performance, while maintaining the original text-to-image capability. The code is available at "),j=a(Wt,"A",{href:!0,rel:!0});var It=s(j);it=u(It,"https://github.com/buxiangzhiren/Asymmetric_VQGAN"),It.forEach(t),Wt.forEach(t),Bt.forEach(t),Je=d(e),se=a(e,"P",{});var zt=s(se);lt=u(zt,"Evaluation results can be found in section 4.1 of the original paper."),zt.forEach(t),Ee=d(e),A=a(e,"H2",{class:!0});var Ie=s(A);L=a(Ie,"A",{id:!0,class:!0,href:!0});var Yt=s(L);me=a(Yt,"SPAN",{});var Ct=s(me);h(Q.$$.fragment,Ct),Ct.forEach(t),Yt.forEach(t),ct=d(Ie),ue=a(Ie,"SPAN",{});var Ft=s(ue);dt=u(Ft,"Available checkpoints"),Ft.forEach(t),Ie.forEach(t),Le=d(e),N=a(e,"UL",{});var ze=s(N);pe=a(ze,"LI",{});var Rt=s(pe);B=a(Rt,"A",{href:!0,rel:!0});var Ot=s(B);mt=u(Ot,"https://huggingface.co/cross-attention/asymmetric-autoencoder-kl-x-1-5"),Ot.forEach(t),Rt.forEach(t),ut=d(ze),fe=a(ze,"LI",{});var qt=s(fe);I=a(qt,"A",{href:!0,rel:!0});var Xt=s(I);pt=u(Xt,"https://huggingface.co/cross-attention/asymmetric-autoencoder-kl-x-2"),Xt.forEach(t),qt.forEach(t),ze.forEach(t),Ne=d(e),k=a(e,"H2",{class:!0});var Ye=s(k);G=a(Ye,"A",{id:!0,class:!0,href:!0});var Pt=s(G);he=a(Pt,"SPAN",{});var Ht=s(he);h(z.$$.fragment,Ht),Ht.forEach(t),Pt.forEach(t),ft=d(Ye),ge=a(Ye,"SPAN",{});var eo=s(ge);ht=u(eo,"Example Usage"),eo.forEach(t),Ye.forEach(t),Ge=d(e),h(Y.$$.fragment,e),Se=d(e),$=a(e,"H2",{class:!0});var Ce=s($);S=a(Ce,"A",{id:!0,class:!0,href:!0});var to=s(S);ye=a(to,"SPAN",{});var oo=s(ye);h(C.$$.fragment,oo),oo.forEach(t),to.forEach(t),gt=d(Ce),ve=a(Ce,"SPAN",{});var no=s(ve);yt=u(no,"AsymmetricAutoencoderKL"),no.forEach(t),Ce.forEach(t),We=d(e),p=a(e,"DIV",{class:!0});var D=s(p);h(F.$$.fragment,D),vt=d(D),R=a(D,"P",{});var Fe=s(R);bt=u(Fe,"Designing a Better Asymmetric VQGAN for StableDiffusion "),O=a(Fe,"A",{href:!0,rel:!0});var ao=s(O);_t=u(ao,"https://arxiv.org/abs/2306.04632"),ao.forEach(t),wt=u(Fe,` . A VAE model with KL loss
for encoding images into latents and decoding latent representations into images.`),Fe.forEach(t),At=d(D),q=a(D,"P",{});var Re=s(q);kt=u(Re,"This model inherits from "),re=a(Re,"A",{href:!0});var so=s(re);$t=u(so,"ModelMixin"),so.forEach(t),Tt=u(Re,`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),Re.forEach(t),Mt=d(D),ie=a(D,"DIV",{class:!0});var ro=s(ie);h(X.$$.fragment,ro),ro.forEach(t),D.forEach(t),Ze=d(e),T=a(e,"H2",{class:!0});var Oe=s(T);W=a(Oe,"A",{id:!0,class:!0,href:!0});var io=s(W);be=a(io,"SPAN",{});var lo=s(be);h(P.$$.fragment,lo),lo.forEach(t),io.forEach(t),Ut=d(Oe),_e=a(Oe,"SPAN",{});var co=s(_e);xt=u(co,"AutoencoderKLOutput"),co.forEach(t),Oe.forEach(t),De=d(e),M=a(e,"DIV",{class:!0});var qe=s(M);h(H.$$.fragment,qe),Jt=d(qe),we=a(qe,"P",{});var mo=s(we);Et=u(mo,"Output of AutoencoderKL encoding method."),mo.forEach(t),qe.forEach(t),Ve=d(e),U=a(e,"H2",{class:!0});var Xe=s(U);Z=a(Xe,"A",{id:!0,class:!0,href:!0});var uo=s(Z);Ae=a(uo,"SPAN",{});var po=s(Ae);h(ee.$$.fragment,po),po.forEach(t),uo.forEach(t),Lt=d(Xe),ke=a(Xe,"SPAN",{});var fo=s(ke);Nt=u(fo,"DecoderOutput"),fo.forEach(t),Xe.forEach(t),Ke=d(e),x=a(e,"DIV",{class:!0});var Pe=s(x);h(te.$$.fragment,Pe),Gt=d(Pe),$e=a(Pe,"P",{});var ho=s($e);St=u(ho,"Output of decoding method."),ho.forEach(t),Pe.forEach(t),this.h()},h(){r(_,"name","hf:doc:metadata"),r(_,"content",JSON.stringify($o)),r(J,"id","asymmetricautoencoderkl"),r(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(J,"href","#asymmetricautoencoderkl"),r(w,"class","relative group"),r(K,"href","https://arxiv.org/abs/2306.04632"),r(K,"rel","nofollow"),r(j,"href","https://github.com/buxiangzhiren/Asymmetric_VQGAN"),r(j,"rel","nofollow"),r(L,"id","available-checkpoints"),r(L,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(L,"href","#available-checkpoints"),r(A,"class","relative group"),r(B,"href","https://huggingface.co/cross-attention/asymmetric-autoencoder-kl-x-1-5"),r(B,"rel","nofollow"),r(I,"href","https://huggingface.co/cross-attention/asymmetric-autoencoder-kl-x-2"),r(I,"rel","nofollow"),r(G,"id","example-usage"),r(G,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(G,"href","#example-usage"),r(k,"class","relative group"),r(S,"id","diffusers.AsymmetricAutoencoderKL"),r(S,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(S,"href","#diffusers.AsymmetricAutoencoderKL"),r($,"class","relative group"),r(O,"href","https://arxiv.org/abs/2306.04632"),r(O,"rel","nofollow"),r(re,"href","/docs/diffusers/v0.20.0/en/api/models/overview#diffusers.ModelMixin"),r(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(W,"id","diffusers.models.autoencoder_kl.AutoencoderKLOutput"),r(W,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(W,"href","#diffusers.models.autoencoder_kl.AutoencoderKLOutput"),r(T,"class","relative group"),r(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(Z,"id","diffusers.models.vae.DecoderOutput"),r(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(Z,"href","#diffusers.models.vae.DecoderOutput"),r(U,"class","relative group"),r(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,i){o(document.head,_),l(e,Te,i),l(e,w,i),o(w,J),o(J,ce),g(V,ce,null),o(w,et),o(w,de),o(de,tt),l(e,Me,i),l(e,E,i),o(E,ot),o(E,K),o(K,nt),o(E,at),l(e,Ue,i),l(e,oe,i),o(oe,st),l(e,xe,i),l(e,ne,i),o(ne,ae),o(ae,rt),o(ae,j),o(j,it),l(e,Je,i),l(e,se,i),o(se,lt),l(e,Ee,i),l(e,A,i),o(A,L),o(L,me),g(Q,me,null),o(A,ct),o(A,ue),o(ue,dt),l(e,Le,i),l(e,N,i),o(N,pe),o(pe,B),o(B,mt),o(N,ut),o(N,fe),o(fe,I),o(I,pt),l(e,Ne,i),l(e,k,i),o(k,G),o(G,he),g(z,he,null),o(k,ft),o(k,ge),o(ge,ht),l(e,Ge,i),g(Y,e,i),l(e,Se,i),l(e,$,i),o($,S),o(S,ye),g(C,ye,null),o($,gt),o($,ve),o(ve,yt),l(e,We,i),l(e,p,i),g(F,p,null),o(p,vt),o(p,R),o(R,bt),o(R,O),o(O,_t),o(R,wt),o(p,At),o(p,q),o(q,kt),o(q,re),o(re,$t),o(q,Tt),o(p,Mt),o(p,ie),g(X,ie,null),l(e,Ze,i),l(e,T,i),o(T,W),o(W,be),g(P,be,null),o(T,Ut),o(T,_e),o(_e,xt),l(e,De,i),l(e,M,i),g(H,M,null),o(M,Jt),o(M,we),o(we,Et),l(e,Ve,i),l(e,U,i),o(U,Z),o(Z,Ae),g(ee,Ae,null),o(U,Lt),o(U,ke),o(ke,Nt),l(e,Ke,i),l(e,x,i),g(te,x,null),o(x,Gt),o(x,$e),o($e,St),je=!0},p:_o,i(e){je||(y(V.$$.fragment,e),y(Q.$$.fragment,e),y(z.$$.fragment,e),y(Y.$$.fragment,e),y(C.$$.fragment,e),y(F.$$.fragment,e),y(X.$$.fragment,e),y(P.$$.fragment,e),y(H.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),je=!0)},o(e){v(V.$$.fragment,e),v(Q.$$.fragment,e),v(z.$$.fragment,e),v(Y.$$.fragment,e),v(C.$$.fragment,e),v(F.$$.fragment,e),v(X.$$.fragment,e),v(P.$$.fragment,e),v(H.$$.fragment,e),v(ee.$$.fragment,e),v(te.$$.fragment,e),je=!1},d(e){t(_),e&&t(Te),e&&t(w),b(V),e&&t(Me),e&&t(E),e&&t(Ue),e&&t(oe),e&&t(xe),e&&t(ne),e&&t(Je),e&&t(se),e&&t(Ee),e&&t(A),b(Q),e&&t(Le),e&&t(N),e&&t(Ne),e&&t(k),b(z),e&&t(Ge),b(Y,e),e&&t(Se),e&&t($),b(C),e&&t(We),e&&t(p),b(F),b(X),e&&t(Ze),e&&t(T),b(P),e&&t(De),e&&t(M),b(H),e&&t(Ve),e&&t(U),b(ee),e&&t(Ke),e&&t(x),b(te)}}}const $o={local:"asymmetricautoencoderkl",sections:[{local:"available-checkpoints",title:"Available checkpoints"},{local:"example-usage",title:"Example Usage"},{local:"diffusers.AsymmetricAutoencoderKL",title:"AsymmetricAutoencoderKL"},{local:"diffusers.models.autoencoder_kl.AutoencoderKLOutput",title:"AutoencoderKLOutput"},{local:"diffusers.models.vae.DecoderOutput",title:"DecoderOutput"}],title:"AsymmetricAutoencoderKL"};function To(Zt){return wo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Eo extends go{constructor(_){super();yo(this,_,To,ko,vo,{})}}export{Eo as default,$o as metadata};
