|
4 | 4 | import torch |
5 | 5 | from cog import BasePredictor, Input, Path |
6 | 6 | from diffusers import ( |
| 7 | + StableDiffusionPipeline, |
| 8 | + PNDMScheduler, |
| 9 | + LMSDiscreteScheduler, |
7 | 10 | DDIMScheduler, |
8 | | - DPMSolverMultistepScheduler, |
9 | 11 | EulerDiscreteScheduler, |
10 | | - StableDiffusionPipeline, |
| 12 | + EulerAncestralDiscreteScheduler, |
| 13 | + DPMSolverMultistepScheduler, |
11 | 14 | ) |
12 | 15 |
|
13 | 16 | MODEL_ID = "stabilityai/stable-diffusion-2-1" |
@@ -62,13 +65,16 @@ def predict( |
62 | 65 | description="Scale for classifier-free guidance", ge=1, le=20, default=7.5 |
63 | 66 | ), |
64 | 67 | scheduler: str = Input( |
65 | | - default="K_EULER", |
| 68 | + default="DPMSolverMultistep", |
66 | 69 | choices=[ |
67 | 70 | "DDIM", |
68 | 71 | "K_EULER", |
69 | 72 | "DPMSolverMultistep", |
| 73 | + "K_EULER_ANCESTRAL", |
| 74 | + "PNDM", |
| 75 | + "KLMS", |
70 | 76 | ], |
71 | | - description="Choose a scheduler", |
| 77 | + description="Choose a scheduler.", |
72 | 78 | ), |
73 | 79 | seed: int = Input( |
74 | 80 | description="Random seed. Leave blank to randomize the seed", default=None |
@@ -110,7 +116,10 @@ def predict( |
110 | 116 |
|
111 | 117 | def make_scheduler(name, config): |
112 | 118 | return { |
| 119 | + "PNDM": PNDMScheduler.from_config(config), |
| 120 | + "KLMS": LMSDiscreteScheduler.from_config(config), |
113 | 121 | "DDIM": DDIMScheduler.from_config(config), |
114 | 122 | "K_EULER": EulerDiscreteScheduler.from_config(config), |
| 123 | + "K_EULER_ANCESTRAL": EulerAncestralDiscreteScheduler.from_config(config), |
115 | 124 | "DPMSolverMultistep": DPMSolverMultistepScheduler.from_config(config), |
116 | 125 | }[name] |
0 commit comments