Buckets:

download
raw
16.7 kB
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 as i,h as Ee,a as d,d as t,b as r,f as v,g as u,j as N,k as A,l as c,m as s,n as p,t as m,o as f,p as g}from"../chunks/index.cac5d66a.js";import{C as Oe}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as P}from"../chunks/Docstring.9de32ff4.js";import{C as Ve}from"../chunks/CodeBlock.606cbaf4.js";import{H as ue,E as Fe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function Ie($e){let _,S,H,R,w,W,k,X,y,ve='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,Ae="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,I,ke=`This model inherits from <a href="/docs/diffusers/pr_13921/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,U,K,ge,G,M,he,z,q,te,B,ne,b,C,_e,j,ye="Output of AutoencoderKL encoding method.",re,E,se,$,O,be,J,Le="Output of decoding method.",le,V,ae,Z,de;return w=new Oe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),k=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>)`,lang:"python",wrap:!1}}),D=new ue({props:{title:"AutoencoderKLAllegro",local:"diffusers.AutoencoderKLAllegro",headingTag:"h2"}}),T=new P({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:": tuple = ('AllegroDownBlock3D', 'AllegroDownBlock3D', 'AllegroDownBlock3D', 'AllegroDownBlock3D')"},{name:"up_block_types",val:": tuple = ('AllegroUpBlock3D', 'AllegroUpBlock3D', 'AllegroUpBlock3D', 'AllegroUpBlock3D')"},{name:"block_out_channels",val:": tuple = (128, 256, 512, 512)"},{name:"temporal_downsample_blocks",val:": tuple = (True, True, False, False)"},{name:"temporal_upsample_blocks",val:": tuple = (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/vr_13921/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L676"}}),K=new P({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLAllegro.decode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/utils/accelerate_utils.py#L43"}}),M=new P({props:{name:"wrapper",anchor:"diffusers.AutoencoderKLAllegro.encode",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/utils/accelerate_utils.py#L43"}}),q=new P({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:": torch._C.Generator | None = 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/vr_13921/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L1041",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>
`}}),B=new ue({props:{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"}}),C=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/vr_13921/src/diffusers/models/modeling_outputs.py#L7"}}),E=new ue({props:{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"}}),O=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:": torch.FloatTensor | None = 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/vr_13921/src/diffusers/models/autoencoders/vae.py#L46"}}),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(),H=a("p"),R=n(),i(w.$$.fragment),W=n(),i(k.$$.fragment),X=n(),y=a("p"),y.innerHTML=ve,Q=n(),L=a("p"),L.textContent=Ae,Y=n(),i(x.$$.fragment),ee=n(),i(D.$$.fragment),oe=n(),l=a("div"),i(T.$$.fragment),pe=n(),F=a("p"),F.innerHTML=we,me=n(),I=a("p"),I.innerHTML=ke,fe=n(),U=a("div"),i(K.$$.fragment),ge=n(),G=a("div"),i(M.$$.fragment),he=n(),z=a("div"),i(q.$$.fragment),te=n(),i(B.$$.fragment),ne=n(),b=a("div"),i(C.$$.fragment),_e=n(),j=a("p"),j.textContent=ye,re=n(),i(E.$$.fragment),se=n(),$=a("div"),i(O.$$.fragment),be=n(),J=a("p"),J.textContent=Le,le=n(),i(V.$$.fragment),ae=n(),Z=a("p"),this.h()},l(e){const o=Ee("svelte-u9bgzb",document.head);_=d(o,"META",{name:!0,content:!0}),o.forEach(t),S=r(e),H=d(e,"P",{}),v(H).forEach(t),R=r(e),u(w.$$.fragment,e),W=r(e),u(k.$$.fragment,e),X=r(e),y=d(e,"P",{"data-svelte-h":!0}),N(y)!=="svelte-1pr3axq"&&(y.innerHTML=ve),Q=r(e),L=d(e,"P",{"data-svelte-h":!0}),N(L)!=="svelte-1vuni30"&&(L.textContent=Ae),Y=r(e),u(x.$$.fragment,e),ee=r(e),u(D.$$.fragment,e),oe=r(e),l=d(e,"DIV",{class:!0});var h=v(l);u(T.$$.fragment,h),pe=r(h),F=d(h,"P",{"data-svelte-h":!0}),N(F)!=="svelte-1inj1b4"&&(F.innerHTML=we),me=r(h),I=d(h,"P",{"data-svelte-h":!0}),N(I)!=="svelte-j24tt4"&&(I.innerHTML=ke),fe=r(h),U=d(h,"DIV",{class:!0});var xe=v(U);u(K.$$.fragment,xe),xe.forEach(t),ge=r(h),G=d(h,"DIV",{class:!0});var De=v(G);u(M.$$.fragment,De),De.forEach(t),he=r(h),z=d(h,"DIV",{class:!0});var Te=v(z);u(q.$$.fragment,Te),Te.forEach(t),h.forEach(t),te=r(e),u(B.$$.fragment,e),ne=r(e),b=d(e,"DIV",{class:!0});var ce=v(b);u(C.$$.fragment,ce),_e=r(ce),j=d(ce,"P",{"data-svelte-h":!0}),N(j)!=="svelte-1vsc7ag"&&(j.textContent=ye),ce.forEach(t),re=r(e),u(E.$$.fragment,e),se=r(e),$=d(e,"DIV",{class:!0});var ie=v($);u(O.$$.fragment,ie),be=r(ie),J=d(ie,"P",{"data-svelte-h":!0}),N(J)!=="svelte-18u8upa"&&(J.textContent=Le),ie.forEach(t),le=r(e),u(V.$$.fragment,e),ae=r(e),Z=d(e,"P",{}),v(Z).forEach(t),this.h()},h(){A(_,"name","hf:doc:metadata"),A(_,"content",Ue),A(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A($,"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){c(document.head,_),s(e,S,o),s(e,H,o),s(e,R,o),p(w,e,o),s(e,W,o),p(k,e,o),s(e,X,o),s(e,y,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),c(l,pe),c(l,F),c(l,me),c(l,I),c(l,fe),c(l,U),p(K,U,null),c(l,ge),c(l,G),p(M,G,null),c(l,he),c(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),c(b,_e),c(b,j),s(e,re,o),p(E,e,o),s(e,se,o),s(e,$,o),p(O,$,null),c($,be),c($,J),s(e,le,o),p(V,e,o),s(e,ae,o),s(e,Z,o),de=!0},p:Me,i(e){de||(m(w.$$.fragment,e),m(k.$$.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),de=!0)},o(e){f(w.$$.fragment,e),f(k.$$.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),de=!1},d(e){e&&(t(S),t(H),t(R),t(W),t(X),t(y),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(k,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 Ue='{"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 Ge($e){return qe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends Be{constructor(_){super(),Ce(this,_,Ge,Ie,Ke,{})}}export{Ze as component};

Xet Storage Details

Size:
16.7 kB
·
Xet hash:
df2a1a838ca4dec9a01be9d555bf9c6b1e6650b0ba22059a19a70f3e7935bfd2

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