Skip to content

Tiny AutoEncoder

用于稳定扩散的Tiny AutoEncoder(TAESD)由Ollin Boer Bohan在madebyollin/taesd中引入。它是稳定扩散VAE的一个小型蒸馏版本,可以几乎瞬间解码[StableDiffusionPipeline]或[StableDiffusionXLPipeline]中的潜在变量。

与稳定扩散v-2.1一起使用:

python
import torch
from diffusers import DiffusionPipeline, AutoencoderTiny

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-2-1-base", torch_dtype=torch.float16
)
pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "slice of delicious New York-style berry cheesecake"
image = pipe(prompt, num_inference_steps=25).images[0]
image

与稳定扩散XL 1.0一起使用

python
import torch
from diffusers import DiffusionPipeline, AutoencoderTiny

pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
)
pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesdxl", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "slice of delicious New York-style berry cheesecake"
image = pipe(prompt, num_inference_steps=25).images[0]
image

AutoencoderTiny

[[autodoc]] AutoencoderTiny

AutoencoderTinyOutput

[[autodoc]] models.autoencoders.autoencoder_tiny.AutoencoderTinyOutput