Views
No views yet
1import torch
2from diffusers import StableDiffusionPipeline, TCDScheduler
3
4device = "cuda"
5base_model_id = "stabilityai/stable-diffusion-2-1-base"
6tcd_lora_id = "h1t/TCD-SD21-base-LoRA"
7
8pipe = StableDiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to(device)
9pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
10
11pipe.load_lora_weights(tcd_lora_id)
12pipe.fuse_lora()
13
14prompt = "Beautiful woman, bubblegum pink, lemon yellow, minty blue, futuristic, high-detail, epic composition, watercolor."
15
16image = pipe(
17 prompt=prompt,
18 num_inference_steps=4,
19 guidance_scale=0,
20 # Eta (referred to as `gamma` in the paper) is used to control the stochasticity in every step.
21 # A value of 0.3 often yields good results.
22 # We recommend using a higher eta when increasing the number of inference steps.
23 eta=0.3,
24 generator=torch.Generator(device=device).manual_seed(0),
25).images[0]