Views
No views yet

1import torch
2from diffusers import StableDiffusionPipeline, AutoencoderKL
3
4repo = "IDKiro/sdxs-512-0.9"
5seed = 42
6weight_type = torch.float32 # or float16
7
8# Load model.
9pipe = StableDiffusionPipeline.from_pretrained(repo, torch_dtype=weight_type)
10
11# use original VAE
12# pipe.vae = AutoencoderKL.from_pretrained("IDKiro/sdxs-512-0.9/vae_large")
13
14pipe.to("cuda")
15
16prompt = "portrait photo of a girl, photograph, highly detailed face, depth of field, moody light, golden hour"
17
18# Ensure using 1 inference step and CFG set to 0.
19image = pipe(
20 prompt,
21 num_inference_steps=1,
22 guidance_scale=0,
23 generator=torch.Generator(device="cuda").manual_seed(seed)
24).images[0]
25
26image.save("output.png")@article{song2024sdxs,
author = {Yuda Song, Zehao Sun, Xuanwu Yin},
title = {SDXS: Real-Time One-Step Latent Diffusion Models with Image Conditions},
journal = {arxiv},
year = {2024},
}