Buckets:
Consistency Decoder
Consistency decoder can be used to decode the latents from the denoising UNet in the StableDiffusionPipeline. This decoder was introduced in the DALL-E 3 technical report.
The original codebase can be found at openai/consistencydecoder.
Inference is only supported for 2 iterations as of now.
The pipeline could not have been contributed without the help of madebyollin and mrsteyk from this issue.
ConsistencyDecoderVAE[[diffusers.ConsistencyDecoderVAE]]
The consistency decoder used with DALL-E 3.
Examples:
>>> import torch
>>> from diffusers import StableDiffusionPipeline, ConsistencyDecoderVAE
>>> vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16)
>>> pipe = StableDiffusionPipeline.from_pretrained(
... "stable-diffusion-v1-5/stable-diffusion-v1-5", vae=vae, torch_dtype=torch.float16
... ).to("cuda")
>>> image = pipe("horse", generator=torch.manual_seed(0)).images[0]
>>> image
- z (torch.Tensor) -- The input latent vector.
- generator (torch.Generator | None) -- The random number generator. Default is None.
- return_dict (bool) -- Whether to return the output as a dictionary. Default is True.
- num_inference_steps (int) -- The number of inference steps. Default is 2.DecoderOutput | tuple[torch.Tensor]The decoded output.
Decodes the input latent vector z using the consistency decoder VAE model.
- x (
torch.Tensor) -- Input batch of images. - return_dict (
bool, optional, defaults toTrue) -- Whether to return aConsistencyDecoderVAEOutputinstead of a plain tuple.The latent representations of the encoded images. Ifreturn_dictis True, aConsistencyDecoderVAEOutputis 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, defaults toNone) -- Generator to use for sampling.DecoderOutputortupleIf return_dict is True, aDecoderOutputis returned, otherwise a plaintupleis returned.
Disables custom attention processors and sets the default attention implementation.
- x (
torch.Tensor) -- Input batch of images. - return_dict (
bool, optional, defaults toTrue) -- Whether or not to return aConsistencyDecoderVAEOutputinstead of a plain tuple.ConsistencyDecoderVAEOutputortupleIf return_dict is True, aConsistencyDecoderVAEOutputis returned, otherwise a plaintupleis returned. Encode a batch of images using a tiled encoder.
When this option is enabled, the VAE will split the input tensor into tiles to compute encoding in several steps. This is useful to keep memory use constant regardless of image size. The end result of tiled encoding is different from non-tiled encoding because each tile uses a different encoder. To avoid tiling artifacts, the tiles overlap and are blended together to form a smooth output. You may still see tile-sized changes in the output, but they should be much less noticeable.
Xet Storage Details
- Size:
- 3.62 kB
- Xet hash:
- 75c7024345b7034274bdffa95a9b9698ee5d3394646f97c3481293eb5f143d24
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.