Buckets:
| import"../chunks/DsnmJJEf.js";import{i as q,h as z,C as F,H as s,a as U,D as o,E as G,s as I}from"../chunks/BtE7mKSK.js";import{p as V,o as E,s as e,f as J,a as k,b as j,c as t,d as D,n,r}from"../chunks/jDjavuwI.js";const N='{"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}';var Z=D('<meta name="hf:doc:metadata"/>'),R=D(`<p></p> <!> <!> <p>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.</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 videos into latents and decoding latent representations into videos. Used in <a href="https://github.com/rhymes-ai/Allegro" rel="nofollow">Allegro</a>.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14252/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).</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 videos.</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 videos 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> <!> <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>Output of AutoencoderKL encoding method.</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>Output of decoding method.</p></div> <!> <p></p>`,1);function H(L,y){V(y,!1),E(()=>{new URLSearchParams(window.location.search).get("fw")}),q();var u=R();z("v9ic1a",A=>{var w=Z();I(w,"content",N),k(A,w)});var p=e(J(u),2);F(p,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var m=e(p,2);s(m,{title:"AutoencoderKLAllegro",local:"autoencoderklallegro",headingTag:"h1"});var f=e(m,6);U(f,{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">"rhymes-ai/Allegro"</span>, subfolder=<span class="hljs-string">"vae"</span>, torch_dtype=torch.float32).to(<span class="hljs-string">"cuda"</span>)`,lang:"python",wrap:!1});var g=e(f,2);s(g,{title:"AutoencoderKLAllegro",local:"diffusers.AutoencoderKLAllegro",headingTag:"h2"});var a=e(g,2),h=t(a);o(h,{name:"class diffusers.AutoencoderKLAllegro",anchor:"diffusers.AutoencoderKLAllegro",source:"https://github.com/huggingface/diffusers/blob/vr_14252/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L676",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>) — | |
| 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>) — | |
| 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>("AllegroDownBlock3D", "AllegroDownBlock3D", "AllegroDownBlock3D", "AllegroDownBlock3D")</code>) — | |
| 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>("AllegroUpBlock3D", "AllegroUpBlock3D", "AllegroUpBlock3D", "AllegroUpBlock3D")</code>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>"silu"</code>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| 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"}]});var l=e(h,6),x=t(l);o(x,{name:"decode",anchor:"diffusers.AutoencoderKLAllegro.decode",source:"https://github.com/huggingface/diffusers/blob/vr_14252/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L843",parameters:[{name:"z",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLAllegro.decode.z",description:`<strong>z</strong> (<code>torch.Tensor</code>) — | |
| Input batch of latent vectors.`,name:"z"},{anchor:"diffusers.AutoencoderKLAllegro.decode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| 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(l);var d=e(l,2),K=t(d);o(K,{name:"encode",anchor:"diffusers.AutoencoderKLAllegro.encode",source:"https://github.com/huggingface/diffusers/blob/vr_14252/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L806",parameters:[{name:"x",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoencoderKLAllegro.encode.x",description:`<strong>x</strong> (<code>torch.Tensor</code>) — | |
| Input batch of videos.`,name:"x"},{anchor:"diffusers.AutoencoderKLAllegro.encode.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| 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 videos. 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(d);var _=e(d,2),T=t(_);o(T,{name:"forward",anchor:"diffusers.AutoencoderKLAllegro.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14252/src/diffusers/models/autoencoders/autoencoder_kl_allegro.py#L1041",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.AutoencoderKLAllegro.forward.sample",description:"<strong>sample</strong> (<code>torch.Tensor</code>) — 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>) — | |
| 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>) — | |
| 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>) — | |
| PyTorch random number generator.`,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(_),r(a);var b=e(a,2);s(b,{title:"AutoencoderKLOutput",local:"diffusers.models.modeling_outputs.AutoencoderKLOutput",headingTag:"h2"});var c=e(b,2),O=t(c);o(O,{name:"class diffusers.models.modeling_outputs.AutoencoderKLOutput",anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14252/src/diffusers/models/modeling_outputs.py#L7",parameters:[{name:"latent_dist",val:": DiagonalGaussianDistribution"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.AutoencoderKLOutput.latent_dist",description:`<strong>latent_dist</strong> (<code>DiagonalGaussianDistribution</code>) — | |
| 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"}]}),n(2),r(c);var v=e(c,2);s(v,{title:"DecoderOutput",local:"diffusers.models.autoencoders.vae.DecoderOutput",headingTag:"h2"});var i=e(v,2),B=t(i);o(B,{name:"class diffusers.models.autoencoders.vae.DecoderOutput",anchor:"diffusers.models.autoencoders.vae.DecoderOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14252/src/diffusers/models/autoencoders/vae.py#L46",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>) — | |
| The decoded output sample from the last layer of the model.`,name:"sample"}]}),n(2),r(i);var M=e(i,2);G(M,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/autoencoderkl_allegro.md"}),n(2),k(L,u),j()}export{H as component}; | |
Xet Storage Details
- Size:
- 15.2 kB
- Xet hash:
- ffa509c177e06226adeeac1b7eec45d0706801525d47e3fdfc3097d2b02ef439
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.