-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsd15_lcm_lora.py
33 lines (30 loc) · 983 Bytes
/
sd15_lcm_lora.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
27
28
29
30
31
32
33
from sd_task.task_runner import run_inference_task
from sd_task.task_args import InferenceTaskArgs
from diffusers.utils import make_image_grid
if __name__ == '__main__':
prompt = "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k"
negative_prompt = ""
args = {
"version": "2.0.0",
"base_model": {
"name": "runwayml/stable-diffusion-v1-5"
},
"prompt": prompt,
"negative_prompt": negative_prompt,
"task_config": {
"num_images": 9,
"safety_checker": False,
"steps": 4,
"cfg": 1
},
"lora": {
"model": "latent-consistency/lcm-lora-sdv1-5",
"weight": 70
},
"scheduler": {
"method": "LCMScheduler"
}
}
images = run_inference_task(InferenceTaskArgs.model_validate(args))
image_grid = make_image_grid(images, 3, 3)
image_grid.save("./data/sd15_lcm_lora.png")