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]]
diffusers.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
wrapperdiffusers.ConsistencyDecoderVAE.decodehttps://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/utils/accelerate_utils.py#L43[{"name": "*args", "val": ""}, {"name": "**kwargs", "val": ""}]
forward[[diffusers.ConsistencyDecoderVAE.forward]]
Parameters:
sample (torch.Tensor) : Input sample.
sample_posterior (bool, optional, defaults to False) : Whether to sample from the posterior.
return_dict (bool, optional, defaults to True) : Whether or not to return a DecoderOutput instead of a plain tuple.
generator (torch.Generator, optional, defaults to None) : Generator to use for sampling.
Returns:
DecoderOutput` or `tuple
If return_dict is True, a DecoderOutput is returned, otherwise a plain tuple is returned.
set_attn_processor[[diffusers.ConsistencyDecoderVAE.set_attn_processor]]
Sets the attention processor to use to compute attention.
Parameters:
processor (dict of AttentionProcessor or only AttentionProcessor) : The instantiated processor class or a dictionary of processor classes that will be set as the processor for all Attention layers. If processor is a dict, the key needs to define the path to the corresponding cross attention processor. This is strongly recommended when setting trainable attention processors.
set_default_attn_processor[[diffusers.ConsistencyDecoderVAE.set_default_attn_processor]]
Disables custom attention processors and sets the default attention implementation.
tiled_encode[[diffusers.ConsistencyDecoderVAE.tiled_encode]]
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.
Parameters:
x (torch.Tensor) : Input batch of images.
return_dict (bool, optional, defaults to True) : Whether or not to return a ConsistencyDecoderVAEOutput instead of a plain tuple.
Returns:
ConsistencyDecoderVAEOutput` or `tuple
If return_dict is True, a ConsistencyDecoderVAEOutput
is returned, otherwise a plain tuple is returned.
Xet Storage Details
- Size:
- 4.52 kB
- Xet hash:
- 52035b7d43fc5551ac127a5265ae4cbe9de9cef72b9a49265c18872cfbdc2e14
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.