import{s as ye,n as Ve,o as De}from"../chunks/scheduler.8c3d61f6.js";import{S as xe,i as Le,g as i,s,r as c,A as ke,h as l,f as o,c as a,j as K,u,x as G,k as U,y as d,a as n,v as m,d as f,t as p,w as g}from"../chunks/index.da70eac4.js";import{D as P}from"../chunks/Docstring.ee4b6913.js";import{C as Te}from"../chunks/CodeBlock.00a903b3.js";import{H as ie,E as Ae}from"../chunks/EditOnGithub.1e64e623.js";function Xe(pe){let _,S,z,R,$,j,w,ge='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/THUDM/CogVideo" rel="nofollow">CogVideoX</a> was introduced in <a href="https://github.com/THUDM/CogVideo/blob/main/resources/CogVideoX.pdf" rel="nofollow">CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer</a> by Tsinghua University &amp; ZhipuAI.',I,C,he="The model can be loaded with the following code snippet.",W,y,Y,V,F,r,D,le,E,_e=`A VAE model with KL loss for encoding images into latents and decoding latent representations into images. Used in
<a href="https://github.com/THUDM/CogVideo" rel="nofollow">CogVideoX</a>.`,de,O,ve=`This model inherits from <a href="/docs/diffusers/v0.30.0/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).`,ce,H,x,ue,Z,L,J,k,Q,v,T,me,q,be="Output of AutoencoderKL encoding method.",ee,A,te,b,X,fe,B,$e="Output of decoding method.",oe,M,ne,N,se;return $=new ie({props:{title:"AutoencoderKLCogVideoX",local:"autoencoderklcogvideox",headingTag:"h1"}}),y=new Te({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xDb2dWaWRlb1glMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMQ29nVmlkZW9YLmZyb21fcHJldHJhaW5lZCglMjJUSFVETSUyRkNvZ1ZpZGVvWC0yYiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnZhZSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLCogVideoX

vae = AutoencoderKLCogVideoX.from_pretrained(<span class="hljs-string">&quot;THUDM/CogVideoX-2b&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),V=new ie({props:{title:"AutoencoderKLCogVideoX",local:"diffusers.AutoencoderKLCogVideoX",headingTag:"h2"}}),D=new P({props:{name:"class diffusers.AutoencoderKLCogVideoX",anchor:"diffusers.AutoencoderKLCogVideoX",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"down_block_types",val:": Tuple = ('CogVideoXDownBlock3D', 'CogVideoXDownBlock3D', 'CogVideoXDownBlock3D', 'CogVideoXDownBlock3D')"},{name:"up_block_types",val:": Tuple = ('CogVideoXUpBlock3D', 'CogVideoXUpBlock3D', 'CogVideoXUpBlock3D', 'CogVideoXUpBlock3D')"},{name:"block_out_channels",val:": Tuple = (128, 256, 256, 512)"},{name:"latent_channels",val:": int = 16"},{name:"layers_per_block",val:": int = 3"},{name:"act_fn",val:": str = 'silu'"},{name:"norm_eps",val:": float = 1e-06"},{name:"norm_num_groups",val:": int = 32"},{name:"temporal_compression_ratio",val:": float = 4"},{name:"sample_size",val:": int = 256"},{name:"scaling_factor",val:": float = 1.15258426"},{name:"shift_factor",val:": Optional = None"},{name:"latents_mean",val:": Optional = None"},{name:"latents_std",val:": Optional = None"},{name:"force_upcast",val:": float = True"},{name:"use_quant_conv",val:": bool = False"},{name:"use_post_quant_conv",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLCogVideoX.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.AutoencoderKLCogVideoX.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.AutoencoderKLCogVideoX.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.AutoencoderKLCogVideoX.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.AutoencoderKLCogVideoX.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(64,)</code>) &#x2014;
Tuple of block output channels.`,name:"block_out_channels"},{anchor:"diffusers.AutoencoderKLCogVideoX.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.AutoencoderKLCogVideoX.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.AutoencoderKLCogVideoX.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"},{anchor:"diffusers.AutoencoderKLCogVideoX.force_upcast",description:`<strong>force_upcast</strong> (<code>bool</code>, <em>optional</em>, default to <code>True</code>) &#x2014;
If enabled it will force the VAE to run in float32 for high image resolution pipelines, such as SD-XL. VAE
can be fine-tuned / trained to a lower range without loosing too much precision in which case
<code>force_upcast</code> can be set to <code>False</code> - see: <a href="https://huggingface.co/madebyollin/sdxl-vae-fp16-fix" rel="nofollow">https://huggingface.co/madebyollin/sdxl-vae-fp16-fix</a>`,name:"force_upcast"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/models/autoencoders/autoencoder_kl_cogvideox.py#L855"}}),x=new P({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLCogVideoX.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/utils/accelerate_utils.py#L43"}}),L=new P({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLCogVideoX.encode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/utils/accelerate_utils.py#L43"}}),k=new ie({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),T=new P({props:{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",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"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/models/modeling_outputs.py#L6"}}),A=new ie({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),X=new P({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",parameters:[{name:"sample",val:": Tensor"},{name:"commit_loss",val:": Optional = 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"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/models/autoencoders/vae.py#L33"}}),M=new Ae({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_cogvideox.md"}}),{c(){_=i("meta"),S=s(),z=i("p"),R=s(),c($.$$.fragment),j=s(),w=i("p"),w.innerHTML=ge,I=s(),C=i("p"),C.textContent=he,W=s(),c(y.$$.fragment),Y=s(),c(V.$$.fragment),F=s(),r=i("div"),c(D.$$.fragment),le=s(),E=i("p"),E.innerHTML=_e,de=s(),O=i("p"),O.innerHTML=ve,ce=s(),H=i("div"),c(x.$$.fragment),ue=s(),Z=i("div"),c(L.$$.fragment),J=s(),c(k.$$.fragment),Q=s(),v=i("div"),c(T.$$.fragment),me=s(),q=i("p"),q.textContent=be,ee=s(),c(A.$$.fragment),te=s(),b=i("div"),c(X.$$.fragment),fe=s(),B=i("p"),B.textContent=$e,oe=s(),c(M.$$.fragment),ne=s(),N=i("p"),this.h()},l(e){const t=ke("svelte-u9bgzb",document.head);_=l(t,"META",{name:!0,content:!0}),t.forEach(o),S=a(e),z=l(e,"P",{}),K(z).forEach(o),R=a(e),u($.$$.fragment,e),j=a(e),w=l(e,"P",{"data-svelte-h":!0}),G(w)!=="svelte-1996cgd"&&(w.innerHTML=ge),I=a(e),C=l(e,"P",{"data-svelte-h":!0}),G(C)!=="svelte-1vuni30"&&(C.textContent=he),W=a(e),u(y.$$.fragment,e),Y=a(e),u(V.$$.fragment,e),F=a(e),r=l(e,"DIV",{class:!0});var h=K(r);u(D.$$.fragment,h),le=a(h),E=l(h,"P",{"data-svelte-h":!0}),G(E)!=="svelte-1rg6lrb"&&(E.innerHTML=_e),de=a(h),O=l(h,"P",{"data-svelte-h":!0}),G(O)!=="svelte-49scso"&&(O.innerHTML=ve),ce=a(h),H=l(h,"DIV",{class:!0});var we=K(H);u(x.$$.fragment,we),we.forEach(o),ue=a(h),Z=l(h,"DIV",{class:!0});var Ce=K(Z);u(L.$$.fragment,Ce),Ce.forEach(o),h.forEach(o),J=a(e),u(k.$$.fragment,e),Q=a(e),v=l(e,"DIV",{class:!0});var ae=K(v);u(T.$$.fragment,ae),me=a(ae),q=l(ae,"P",{"data-svelte-h":!0}),G(q)!=="svelte-1vsc7ag"&&(q.textContent=be),ae.forEach(o),ee=a(e),u(A.$$.fragment,e),te=a(e),b=l(e,"DIV",{class:!0});var re=K(b);u(X.$$.fragment,re),fe=a(re),B=l(re,"P",{"data-svelte-h":!0}),G(B)!=="svelte-18u8upa"&&(B.textContent=$e),re.forEach(o),oe=a(e),u(M.$$.fragment,e),ne=a(e),N=l(e,"P",{}),K(N).forEach(o),this.h()},h(){U(_,"name","hf:doc:metadata"),U(_,"content",Me),U(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(b,"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,t){d(document.head,_),n(e,S,t),n(e,z,t),n(e,R,t),m($,e,t),n(e,j,t),n(e,w,t),n(e,I,t),n(e,C,t),n(e,W,t),m(y,e,t),n(e,Y,t),m(V,e,t),n(e,F,t),n(e,r,t),m(D,r,null),d(r,le),d(r,E),d(r,de),d(r,O),d(r,ce),d(r,H),m(x,H,null),d(r,ue),d(r,Z),m(L,Z,null),n(e,J,t),m(k,e,t),n(e,Q,t),n(e,v,t),m(T,v,null),d(v,me),d(v,q),n(e,ee,t),m(A,e,t),n(e,te,t),n(e,b,t),m(X,b,null),d(b,fe),d(b,B),n(e,oe,t),m(M,e,t),n(e,ne,t),n(e,N,t),se=!0},p:Ve,i(e){se||(f($.$$.fragment,e),f(y.$$.fragment,e),f(V.$$.fragment,e),f(D.$$.fragment,e),f(x.$$.fragment,e),f(L.$$.fragment,e),f(k.$$.fragment,e),f(T.$$.fragment,e),f(A.$$.fragment,e),f(X.$$.fragment,e),f(M.$$.fragment,e),se=!0)},o(e){p($.$$.fragment,e),p(y.$$.fragment,e),p(V.$$.fragment,e),p(D.$$.fragment,e),p(x.$$.fragment,e),p(L.$$.fragment,e),p(k.$$.fragment,e),p(T.$$.fragment,e),p(A.$$.fragment,e),p(X.$$.fragment,e),p(M.$$.fragment,e),se=!1},d(e){e&&(o(S),o(z),o(R),o(j),o(w),o(I),o(C),o(W),o(Y),o(F),o(r),o(J),o(Q),o(v),o(ee),o(te),o(b),o(oe),o(ne),o(N)),o(_),g($,e),g(y,e),g(V,e),g(D),g(x),g(L),g(k,e),g(T),g(A,e),g(X),g(M,e)}}}const Me='{"title":"AutoencoderKLCogVideoX","local":"autoencoderklcogvideox","sections":[{"title":"AutoencoderKLCogVideoX","local":"diffusers.AutoencoderKLCogVideoX","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}';function Ke(pe){return De(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qe extends xe{constructor(_){super(),Le(this,_,Ke,Xe,ye,{})}}export{qe as component};
