DeepCache?
Browse files- app.py +9 -3
- requirements.txt +1 -1
app.py
CHANGED
@@ -30,15 +30,21 @@ inpainting_pipeline = StableDiffusionInpaintPipeline.from_pretrained(
|
|
30 |
safety_checker=None,
|
31 |
).to(preferred_device)
|
32 |
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
# inpainting_pipeline.scheduler = LCMScheduler.from_config(inpainting_pipeline.scheduler.config)
|
37 |
# inpainting_pipeline.load_lora_weights("latent-consistency/lcm-lora-sdv1-5", torch_dtype=preferred_dtype)
|
38 |
# inpainting_pipeline.fuse_lora()
|
39 |
|
40 |
seg_working_size = (seg_model_img_size, seg_model_img_size)
|
41 |
-
repaint_working_size = (
|
42 |
|
43 |
default_inpainting_prompt = "award-winning photo of a leafy pedestrian mall full of people, with multiracial genderqueer joggers and bicyclists and wheelchair users talking and laughing"
|
44 |
|
|
|
30 |
safety_checker=None,
|
31 |
).to(preferred_device)
|
32 |
|
33 |
+
from DeepCache import DeepCacheSDHelper
|
34 |
+
helper = DeepCacheSDHelper(pipe=inpainting_pipeline)
|
35 |
+
helper.set_params(cache_interval=3, cache_branch_id=0)
|
36 |
+
helper.enable()
|
37 |
+
|
38 |
+
if preferred_device == "cuda":
|
39 |
+
inpainting_pipeline.unet = torch.compile(inpainting_pipeline.unet)
|
40 |
+
inpainting_pipeline.vae = torch.compile(inpainting_pipeline.vae)
|
41 |
|
42 |
# inpainting_pipeline.scheduler = LCMScheduler.from_config(inpainting_pipeline.scheduler.config)
|
43 |
# inpainting_pipeline.load_lora_weights("latent-consistency/lcm-lora-sdv1-5", torch_dtype=preferred_dtype)
|
44 |
# inpainting_pipeline.fuse_lora()
|
45 |
|
46 |
seg_working_size = (seg_model_img_size, seg_model_img_size)
|
47 |
+
repaint_working_size = (512, 512)
|
48 |
|
49 |
default_inpainting_prompt = "award-winning photo of a leafy pedestrian mall full of people, with multiracial genderqueer joggers and bicyclists and wheelchair users talking and laughing"
|
50 |
|
requirements.txt
CHANGED
@@ -4,4 +4,4 @@ torch==2.2.1
|
|
4 |
accelerate
|
5 |
peft
|
6 |
optimum
|
7 |
-
|
|
|
4 |
accelerate
|
5 |
peft
|
6 |
optimum
|
7 |
+
DeepCache
|