微自动编码器(TAESD)是Stable Diffusion的VAE的一个微调版本,几乎可以立即快速解码[StableDiffusionPipeline]或降低[StableDiffusionXLPipeline]中的延迟。
import os os.environ["HF_ENDPOINT"] = "https://hf-mirror.com" mport 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.save("auto01.png")