Buckets:
AutoencoderKLKVAE
The 2D variational autoencoder (VAE) model with KL loss.
The model can be loaded with the following code snippet.
import torch
from diffusers import AutoencoderKLKVAE
vae = AutoencoderKLKVAE.from_pretrained("kandinskylab/KVAE-2D-1.0", subfolder="diffusers", torch_dtype=torch.bfloat16)
AutoencoderKLKVAE[[diffusers.AutoencoderKLKVAE]]
- in_channels (int, optional, defaults to 3) -- Number of channels in the input image.
- channels (int, optional, defaults to 128) -- The base number of channels in multiresolution blocks.
- num_enc_blocks (int, optional, defaults to 2) -- The number of Resnet blocks in encoder multiresolution layers.
- num_dec_blocks (int, optional, defaults to 2) -- The number of Resnet blocks in decoder multiresolution layers.
- z_channels (int, optional, defaults to 16) -- Number of channels in the latent space.
- double_z (
bool, optional, defaults toTrue) -- Whether to double the number of output channels of encoder. - ch_mult (
Tuple[int, ...], optional, default to(1, 2, 4, 8)) -- The channel multipliers in multiresolution blocks. - sample_size (
int, optional, defaults to1024) -- Sample input size.
A VAE model with KL loss for encoding images into latents and decoding latent representations into images.
This model inherits from ModelMixin. Check the superclass documentation for its generic methods implemented for all models (such as downloading or saving).
- z (
torch.Tensor) -- Input batch of latent vectors. - return_dict (
bool, optional, defaults toTrue) -- Whether to return a~models.vae.DecoderOutputinstead of a plain tuple.~models.vae.DecoderOutputortupleIf return_dict is True, a~models.vae.DecoderOutputis returned, otherwise a plaintupleis returned.
Decode a batch of images.
- x (
torch.Tensor) -- Input batch of images. - return_dict (
bool, optional, defaults toTrue) -- Whether to return a~models.autoencoder_kl.AutoencoderKLOutputinstead of a plain tuple.The latent representations of the encoded images. Ifreturn_dictis True, a~models.autoencoder_kl.AutoencoderKLOutputis returned, otherwise a plaintupleis returned.
Encode a batch of images into latents.
sample (
torch.Tensor) -- Input sample.sample_posterior (
bool, optional, defaults toFalse) -- Whether to sample from the posterior.return_dict (
bool, optional, defaults toTrue) -- Whether or not to return aDecoderOutputinstead of a plain tuple.generator (
torch.Generator, optional) -- Atorch.Generatorto make sampling deterministic.~models.vae.DecoderOutputortupleIfreturn_dictis True, a~models.vae.DecoderOutputis returned, otherwise a plaintupleis returned.z (
torch.Tensor) -- Input batch of latent vectors.return_dict (
bool, optional, defaults toTrue) -- Whether or not to return a~models.vae.DecoderOutputinstead of a plain tuple.~models.vae.DecoderOutputortupleIf return_dict is True, a~models.vae.DecoderOutputis returned, otherwise a plaintupleis returned.
Decode a batch of images using a tiled decoder.
Xet Storage Details
- Size:
- 3.38 kB
- Xet hash:
- 6d6efaeaa7dc73e8f3d53e7fcd20f8b1bb92007d1b19b0ba0ec40f4f56ecedc7
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.