-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdemo_animagine_xl.py
26 lines (21 loc) · 1.07 KB
/
demo_animagine_xl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import torch
from diffusers import StableDiffusionXLPipeline
from scheduling_tcd import TCDScheduler
device = "cuda"
base_model_id = "cagliostrolab/animagine-xl-3.0"
tcd_lora_id = "h1t/TCD-SDXL-LoRA"
pipe = StableDiffusionXLPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to(device)
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()
prompt = "A man, clad in a meticulously tailored military uniform, stands with unwavering resolve. The uniform boasts intricate details, and his eyes gleam with determination. Strands of vibrant, windswept hair peek out from beneath the brim of his cap."
image = pipe(
prompt=prompt,
num_inference_steps=8,
guidance_scale=0,
# Eta (referred to as `gamma` in the paper) is used to control the stochasticity in every step.
# A value of 0.3 often yields good results.
# We recommend using a higher eta when increasing the number of inference steps.
eta=0.3,
generator=torch.Generator(device=device).manual_seed(0),
).images[0]