Skip to content

Commit 88550b8

Browse files
author
Jesse Andrews
authored
Merge pull request #63 from chenxwh/more-schedulers
add back schedulers for v2.1
2 parents 0daf5ee + bc0c70b commit 88550b8

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Stable Diffusion v2 Cog model
22

3-
[![Replicate](https://replicate.com/cjwbw/stable-diffusion-v2/badge)](https://replicate.com/cjwbw/stable-diffusion-v2)
3+
[![Replicate](https://replicate.com/stability-ai/stable-diffusion/badge)](https://replicate.com/stability-ai/stable-diffusion)
44

5-
This is an implementation of the [Diffusers Stable Diffusion v2](https://huggingface.co/stabilityai/stable-diffusion-2) as a Cog model. [Cog packages machine learning models as standard containers.](https://github.com/replicate/cog)
5+
This is an implementation of the [Diffusers Stable Diffusion v2.1](https://huggingface.co/stabilityai/stable-diffusion-2-1) as a Cog model. [Cog packages machine learning models as standard containers.](https://github.com/replicate/cog)
66

77
First, download the pre-trained weights:
88

predict.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
import torch
55
from cog import BasePredictor, Input, Path
66
from diffusers import (
7+
StableDiffusionPipeline,
8+
PNDMScheduler,
9+
LMSDiscreteScheduler,
710
DDIMScheduler,
8-
DPMSolverMultistepScheduler,
911
EulerDiscreteScheduler,
10-
StableDiffusionPipeline,
12+
EulerAncestralDiscreteScheduler,
13+
DPMSolverMultistepScheduler,
1114
)
1215

1316
MODEL_ID = "stabilityai/stable-diffusion-2-1"
@@ -62,13 +65,16 @@ def predict(
6265
description="Scale for classifier-free guidance", ge=1, le=20, default=7.5
6366
),
6467
scheduler: str = Input(
65-
default="K_EULER",
68+
default="DPMSolverMultistep",
6669
choices=[
6770
"DDIM",
6871
"K_EULER",
6972
"DPMSolverMultistep",
73+
"K_EULER_ANCESTRAL",
74+
"PNDM",
75+
"KLMS",
7076
],
71-
description="Choose a scheduler",
77+
description="Choose a scheduler.",
7278
),
7379
seed: int = Input(
7480
description="Random seed. Leave blank to randomize the seed", default=None
@@ -110,7 +116,10 @@ def predict(
110116

111117
def make_scheduler(name, config):
112118
return {
119+
"PNDM": PNDMScheduler.from_config(config),
120+
"KLMS": LMSDiscreteScheduler.from_config(config),
113121
"DDIM": DDIMScheduler.from_config(config),
114122
"K_EULER": EulerDiscreteScheduler.from_config(config),
123+
"K_EULER_ANCESTRAL": EulerAncestralDiscreteScheduler.from_config(config),
115124
"DPMSolverMultistep": DPMSolverMultistepScheduler.from_config(config),
116125
}[name]

0 commit comments

Comments
 (0)