Spaces:
Runtime error
Runtime error
Add DPM
Browse files- app.py +12 -4
- requirements.txt +3 -2
app.py
CHANGED
@@ -15,6 +15,8 @@ from diffusers import (
|
|
15 |
StableDiffusionInpaintPipelineLegacy,
|
16 |
DDIMScheduler,
|
17 |
LMSDiscreteScheduler,
|
|
|
|
|
18 |
)
|
19 |
from diffusers.models import AutoencoderKL
|
20 |
from PIL import Image
|
@@ -242,7 +244,7 @@ def load_learned_embed_in_clip(
|
|
242 |
text_encoder.get_input_embeddings().weight.data[token_id] = embeds
|
243 |
|
244 |
|
245 |
-
scheduler_dict = {"PLMS": None, "DDIM": None, "K-LMS": None}
|
246 |
|
247 |
|
248 |
class StableDiffusionInpaint:
|
@@ -317,6 +319,9 @@ class StableDiffusionInpaint:
|
|
317 |
beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear"
|
318 |
)
|
319 |
)
|
|
|
|
|
|
|
320 |
self.safety_checker = inpaint.safety_checker
|
321 |
save_token(token)
|
322 |
try:
|
@@ -517,6 +522,9 @@ class StableDiffusion:
|
|
517 |
beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear"
|
518 |
)
|
519 |
)
|
|
|
|
|
|
|
520 |
self.safety_checker = text2img.safety_checker
|
521 |
img2img = StableDiffusionImg2ImgPipeline(
|
522 |
vae=text2img.vae,
|
@@ -867,13 +875,13 @@ with blocks as demo:
|
|
867 |
"perlin",
|
868 |
"gaussian",
|
869 |
],
|
870 |
-
value="
|
871 |
type="value",
|
872 |
)
|
873 |
postprocess_check = gr.Radio(
|
874 |
label="Photometric Correction Mode",
|
875 |
choices=["disabled", "mask_mode", "border_mode",],
|
876 |
-
value="
|
877 |
type="value",
|
878 |
)
|
879 |
# canvas control
|
@@ -906,7 +914,7 @@ with blocks as demo:
|
|
906 |
)
|
907 |
sd_scheduler_eta = gr.Number(label="Eta", value=0.0)
|
908 |
with gr.Column(scale=1, min_width=80):
|
909 |
-
sd_step = gr.Number(label="Step", value=
|
910 |
sd_guidance = gr.Number(label="Guidance", value=7.5)
|
911 |
|
912 |
proceed_button = gr.Button("Proceed", elem_id="proceed", visible=DEBUG_MODE)
|
|
|
15 |
StableDiffusionInpaintPipelineLegacy,
|
16 |
DDIMScheduler,
|
17 |
LMSDiscreteScheduler,
|
18 |
+
StableDiffusionUpscalePipeline,
|
19 |
+
DPMSolverMultistepScheduler
|
20 |
)
|
21 |
from diffusers.models import AutoencoderKL
|
22 |
from PIL import Image
|
|
|
244 |
text_encoder.get_input_embeddings().weight.data[token_id] = embeds
|
245 |
|
246 |
|
247 |
+
scheduler_dict = {"PLMS": None, "DDIM": None, "K-LMS": None, "DPM": None}
|
248 |
|
249 |
|
250 |
class StableDiffusionInpaint:
|
|
|
319 |
beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear"
|
320 |
)
|
321 |
)
|
322 |
+
scheduler_dict["DPM"] = prepare_scheduler(
|
323 |
+
DPMSolverMultistepScheduler.from_config(inpaint.scheduler.config)
|
324 |
+
)
|
325 |
self.safety_checker = inpaint.safety_checker
|
326 |
save_token(token)
|
327 |
try:
|
|
|
522 |
beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear"
|
523 |
)
|
524 |
)
|
525 |
+
scheduler_dict["DPM"] = prepare_scheduler(
|
526 |
+
DPMSolverMultistepScheduler.from_config(text2img.scheduler.config)
|
527 |
+
)
|
528 |
self.safety_checker = text2img.safety_checker
|
529 |
img2img = StableDiffusionImg2ImgPipeline(
|
530 |
vae=text2img.vae,
|
|
|
875 |
"perlin",
|
876 |
"gaussian",
|
877 |
],
|
878 |
+
value="cv2_ns",
|
879 |
type="value",
|
880 |
)
|
881 |
postprocess_check = gr.Radio(
|
882 |
label="Photometric Correction Mode",
|
883 |
choices=["disabled", "mask_mode", "border_mode",],
|
884 |
+
value="mask_mode",
|
885 |
type="value",
|
886 |
)
|
887 |
# canvas control
|
|
|
914 |
)
|
915 |
sd_scheduler_eta = gr.Number(label="Eta", value=0.0)
|
916 |
with gr.Column(scale=1, min_width=80):
|
917 |
+
sd_step = gr.Number(label="Step", value=25, precision=0)
|
918 |
sd_guidance = gr.Number(label="Guidance", value=7.5)
|
919 |
|
920 |
proceed_button = gr.Button("Proceed", elem_id="proceed", visible=DEBUG_MODE)
|
requirements.txt
CHANGED
@@ -8,7 +8,8 @@ torchvision==0.13.1+cu113
|
|
8 |
Pillow
|
9 |
scipy
|
10 |
scikit-image
|
11 |
-
diffusers==0.
|
12 |
transformers
|
13 |
ftfy
|
14 |
-
fpie
|
|
|
|
8 |
Pillow
|
9 |
scipy
|
10 |
scikit-image
|
11 |
+
diffusers==0.9.0
|
12 |
transformers
|
13 |
ftfy
|
14 |
+
fpie
|
15 |
+
accelerate
|