import{s as Ke,n as Me,o as qe}from"../chunks/scheduler.53228c21.js";import{S as Be,i as Ce,e as a,s as n,c,h as Ee,a as i,d as t,b as r,f as A,g as u,j as P,k as v,l as d,m as s,n as p,t as m,o as f,p as g}from"../chunks/index.100fac89.js";import{C as Oe}from"../chunks/CopyLLMTxtMenu.999d3d86.js";import{D as H}from"../chunks/Docstring.46d0934e.js";import{C as Ve}from"../chunks/CodeBlock.d30a6509.js";import{H as ue,E as Fe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function Ue($e){let _,S,N,R,w,W,y,X,k,Ae='The 3D variational autoencoder (VAE) model with KL loss used in <a href="https://github.com/rhymes-ai/Allegro" rel="nofollow">Allegro</a> was introduced in <a href="https://huggingface.co/papers/2410.15458" rel="nofollow">Allegro: Open the Black Box of Commercial-Level Video Generation Model</a> by RhymesAI.',Q,L,ve="The model can be loaded with the following code snippet.",Y,x,ee,D,oe,l,T,pe,F,we=`A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. Used in
<a href="https://github.com/rhymes-ai/Allegro" rel="nofollow">Allegro</a>.`,me,U,ye=`This model inherits from <a href="/docs/diffusers/main/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).`,fe,G,K,ge,I,M,he,z,q,te,B,ne,b,C,_e,j,ke="Output of AutoencoderKL encoding method.",re,E,se,$,O,be,J,Le="Output of decoding method.",le,V,ae,Z,ie;return w=new Oe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new ue({props:{title:"AutoencoderKLAllegro",local:"autoencoderklallegro",headingTag:"h1"}}),x=new Ve({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xBbGxlZ3JvJTBBJTBBdmFlJTIwJTNEJTIwQXV0b2VuY29kZXJLTEFsbGVncm8uZnJvbV9wcmV0cmFpbmVkKCUyMnJoeW1lcy1haSUyRkFsbGVncm8lMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MzIpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLAllegro

vae = AutoencoderKLAllegro.from_pretrained(<span class="hljs-string">&quot;rhymes-ai/Allegro&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),D=new ue({props:{title:"AutoencoderKLAllegro",local:"diffusers.AutoencoderKLAllegro",headingTag:"h2"}}),T=new H({props:{name:"class diffusers.AutoencoderKLAllegro",anchor:"diffusers.AutoencoderKLAllegro",parameters:[{name:"in_channels",val:": int = 3"},{name:"out_channels",val:": int = 3"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ('AllegroDownBlock3D', 'AllegroDownBlock3D', 'AllegroDownBlock3D', 'AllegroDownBlock3D')"},{name:"up_block_types",val:": typing.Tuple[str, ...] = ('AllegroUpBlock3D', 'AllegroUpBlock3D', 'AllegroUpBlock3D', 'AllegroUpBlock3D')"},{name:"block_out_channels",val:": typing.Tuple[int, ...] = (128, 256, 512, 512)"},{name:"temporal_downsample_blocks",val:": typing.Tuple[bool, ...] = (True, True, False, False)"},{name:"temporal_upsample_blocks",val:": typing.Tuple[bool, ...] = (False, True, True, False)"},{name:"latent_channels",val:": int = 4"},{name:"layers_per_block",val:": int = 2"},{name:"act_fn",val:": str = 'silu'"},{name:"norm_num_groups",val:": int = 32"},{name:"temporal_compression_ratio",val:": float = 4"},{name:"sample_size",val:": int = 320"},{name:"scaling_factor",val:": float = 0.13"},{name:"force_upcast",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLAllegro.in_channels",description:`<strong>in_channels</strong> (int, defaults to <code>3</code>) &#x2014;
Number of channels in the input image.`,name:"in_channels"},{anchor:"diffusers.AutoencoderKLAllegro.out_channels",description:`<strong>out_channels</strong> (int, defaults to <code>3</code>) &#x2014;
Number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.AutoencoderKLAllegro.down_block_types",description:`<strong>down_block_types</strong> (<code>Tuple[str, ...]</code>, defaults to <code>(&quot;AllegroDownBlock3D&quot;, &quot;AllegroDownBlock3D&quot;, &quot;AllegroDownBlock3D&quot;, &quot;AllegroDownBlock3D&quot;)</code>) &#x2014;
Tuple of strings denoting which types of down blocks to use.`,name:"down_block_types"},{anchor:"diffusers.AutoencoderKLAllegro.up_block_types",description:`<strong>up_block_types</strong> (<code>Tuple[str, ...]</code>, defaults to <code>(&quot;AllegroUpBlock3D&quot;, &quot;AllegroUpBlock3D&quot;, &quot;AllegroUpBlock3D&quot;, &quot;AllegroUpBlock3D&quot;)</code>) &#x2014;
Tuple of strings denoting which types of up blocks to use.`,name:"up_block_types"},{anchor:"diffusers.AutoencoderKLAllegro.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int, ...]</code>, defaults to <code>(128, 256, 512, 512)</code>) &#x2014;
Tuple of integers denoting number of output channels in each block.`,name:"block_out_channels"},{anchor:"diffusers.AutoencoderKLAllegro.temporal_downsample_blocks",description:`<strong>temporal_downsample_blocks</strong> (<code>Tuple[bool, ...]</code>, defaults to <code>(True, True, False, False)</code>) &#x2014;
Tuple of booleans denoting which blocks to enable temporal downsampling in.`,name:"temporal_downsample_blocks"},{anchor:"diffusers.AutoencoderKLAllegro.latent_channels",description:`<strong>latent_channels</strong> (<code>int</code>, defaults to <code>4</code>) &#x2014;
Number of channels in latents.`,name:"latent_channels"},{anchor:"diffusers.AutoencoderKLAllegro.layers_per_block",description:`<strong>layers_per_block</strong> (<code>int</code>, defaults to <code>2</code>) &#x2014;
Number of resnet or attention or temporal convolution layers per down/up block.`,name:"layers_per_block"},{anchor:"diffusers.AutoencoderKLAllegro.act_fn",description:`<strong>act_fn</strong> (<code>str</code>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The activation function to use.`,name:"act_fn"},{anchor:"diffusers.AutoencoderKLAllegro.norm_num_groups",description:`<strong>norm_num_groups</strong> (<code>int</code>, defaults to <code>32</code>) &#x2014;
Number of groups to use in normalization layers.`,name:"norm_num_groups"},{anchor:"diffusers.AutoencoderKLAllegro.temporal_compression_ratio",description:`<strong>temporal_compression_ratio</strong> (<code>int</code>, defaults to <code>4</code>) &#x2014;
Ratio by which temporal dimension of samples are compressed.`,name:"temporal_compression_ratio"},{anchor:"diffusers.AutoencoderKLAllegro.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, defaults to <code>320</code>) &#x2014;
Default latent size.`,name:"sample_size"},{anchor:"diffusers.AutoencoderKLAllegro.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, defaults to <code>0.13235</code>) &#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://huggingface.co/papers/2112.10752" rel="nofollow">High-Resolution Image
Synthesis with Latent Diffusion Models</a> paper.`,name:"scaling_factor"},{anchor:"diffusers.AutoencoderKLAllegro.force_upcast",description:`<strong>force_upcast</strong> (<code>bool</code>, 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 losing 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/main/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L677"}}),K=new H({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLAllegro.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),M=new H({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLAllegro.encode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/accelerate_utils.py#L43"}}),q=new H({props:{name:"forward",anchor:"diffusers.AutoencoderKLAllegro.forward",parameters:[{name:"sample",val:": Tensor"},{name:"sample_posterior",val:": bool = False"},{name:"return_dict",val:": bool = True"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLAllegro.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014; Input sample.",name:"sample"},{anchor:"diffusers.AutoencoderKLAllegro.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.AutoencoderKLAllegro.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.AutoencoderKLAllegro.forward.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
PyTorch random number generator.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L1042"}}),B=new ue({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),C=new H({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/main/src/diffusers/models/modeling_outputs.py#L7"}}),E=new ue({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),O=new H({props:{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/vae.py#L47"}}),V=new Fe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_allegro.md"}}),{c(){_=a("meta"),S=n(),N=a("p"),R=n(),c(w.$$.fragment),W=n(),c(y.$$.fragment),X=n(),k=a("p"),k.innerHTML=Ae,Q=n(),L=a("p"),L.textContent=ve,Y=n(),c(x.$$.fragment),ee=n(),c(D.$$.fragment),oe=n(),l=a("div"),c(T.$$.fragment),pe=n(),F=a("p"),F.innerHTML=we,me=n(),U=a("p"),U.innerHTML=ye,fe=n(),G=a("div"),c(K.$$.fragment),ge=n(),I=a("div"),c(M.$$.fragment),he=n(),z=a("div"),c(q.$$.fragment),te=n(),c(B.$$.fragment),ne=n(),b=a("div"),c(C.$$.fragment),_e=n(),j=a("p"),j.textContent=ke,re=n(),c(E.$$.fragment),se=n(),$=a("div"),c(O.$$.fragment),be=n(),J=a("p"),J.textContent=Le,le=n(),c(V.$$.fragment),ae=n(),Z=a("p"),this.h()},l(e){const o=Ee("svelte-u9bgzb",document.head);_=i(o,"META",{name:!0,content:!0}),o.forEach(t),S=r(e),N=i(e,"P",{}),A(N).forEach(t),R=r(e),u(w.$$.fragment,e),W=r(e),u(y.$$.fragment,e),X=r(e),k=i(e,"P",{"data-svelte-h":!0}),P(k)!=="svelte-1pr3axq"&&(k.innerHTML=Ae),Q=r(e),L=i(e,"P",{"data-svelte-h":!0}),P(L)!=="svelte-1vuni30"&&(L.textContent=ve),Y=r(e),u(x.$$.fragment,e),ee=r(e),u(D.$$.fragment,e),oe=r(e),l=i(e,"DIV",{class:!0});var h=A(l);u(T.$$.fragment,h),pe=r(h),F=i(h,"P",{"data-svelte-h":!0}),P(F)!=="svelte-1inj1b4"&&(F.innerHTML=we),me=r(h),U=i(h,"P",{"data-svelte-h":!0}),P(U)!=="svelte-1hyu2ru"&&(U.innerHTML=ye),fe=r(h),G=i(h,"DIV",{class:!0});var xe=A(G);u(K.$$.fragment,xe),xe.forEach(t),ge=r(h),I=i(h,"DIV",{class:!0});var De=A(I);u(M.$$.fragment,De),De.forEach(t),he=r(h),z=i(h,"DIV",{class:!0});var Te=A(z);u(q.$$.fragment,Te),Te.forEach(t),h.forEach(t),te=r(e),u(B.$$.fragment,e),ne=r(e),b=i(e,"DIV",{class:!0});var de=A(b);u(C.$$.fragment,de),_e=r(de),j=i(de,"P",{"data-svelte-h":!0}),P(j)!=="svelte-1vsc7ag"&&(j.textContent=ke),de.forEach(t),re=r(e),u(E.$$.fragment,e),se=r(e),$=i(e,"DIV",{class:!0});var ce=A($);u(O.$$.fragment,ce),be=r(ce),J=i(ce,"P",{"data-svelte-h":!0}),P(J)!=="svelte-18u8upa"&&(J.textContent=Le),ce.forEach(t),le=r(e),u(V.$$.fragment,e),ae=r(e),Z=i(e,"P",{}),A(Z).forEach(t),this.h()},h(){v(_,"name","hf:doc:metadata"),v(_,"content",Ge),v(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v($,"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,o){d(document.head,_),s(e,S,o),s(e,N,o),s(e,R,o),p(w,e,o),s(e,W,o),p(y,e,o),s(e,X,o),s(e,k,o),s(e,Q,o),s(e,L,o),s(e,Y,o),p(x,e,o),s(e,ee,o),p(D,e,o),s(e,oe,o),s(e,l,o),p(T,l,null),d(l,pe),d(l,F),d(l,me),d(l,U),d(l,fe),d(l,G),p(K,G,null),d(l,ge),d(l,I),p(M,I,null),d(l,he),d(l,z),p(q,z,null),s(e,te,o),p(B,e,o),s(e,ne,o),s(e,b,o),p(C,b,null),d(b,_e),d(b,j),s(e,re,o),p(E,e,o),s(e,se,o),s(e,$,o),p(O,$,null),d($,be),d($,J),s(e,le,o),p(V,e,o),s(e,ae,o),s(e,Z,o),ie=!0},p:Me,i(e){ie||(m(w.$$.fragment,e),m(y.$$.fragment,e),m(x.$$.fragment,e),m(D.$$.fragment,e),m(T.$$.fragment,e),m(K.$$.fragment,e),m(M.$$.fragment,e),m(q.$$.fragment,e),m(B.$$.fragment,e),m(C.$$.fragment,e),m(E.$$.fragment,e),m(O.$$.fragment,e),m(V.$$.fragment,e),ie=!0)},o(e){f(w.$$.fragment,e),f(y.$$.fragment,e),f(x.$$.fragment,e),f(D.$$.fragment,e),f(T.$$.fragment,e),f(K.$$.fragment,e),f(M.$$.fragment,e),f(q.$$.fragment,e),f(B.$$.fragment,e),f(C.$$.fragment,e),f(E.$$.fragment,e),f(O.$$.fragment,e),f(V.$$.fragment,e),ie=!1},d(e){e&&(t(S),t(N),t(R),t(W),t(X),t(k),t(Q),t(L),t(Y),t(ee),t(oe),t(l),t(te),t(ne),t(b),t(re),t(se),t($),t(le),t(ae),t(Z)),t(_),g(w,e),g(y,e),g(x,e),g(D,e),g(T),g(K),g(M),g(q),g(B,e),g(C),g(E,e),g(O),g(V,e)}}}const Ge='{"title":"AutoencoderKLAllegro","local":"autoencoderklallegro","sections":[{"title":"AutoencoderKLAllegro","local":"diffusers.AutoencoderKLAllegro","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 Ie($e){return qe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends Be{constructor(_){super(),Ce(this,_,Ie,Ue,Ke,{})}}export{Ze as component};
