Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
4c4a1d7
1
Parent(s):
cb6f2d9
enable CPU offloading
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import torch
|
2 |
import spaces
|
3 |
-
from diffusers import ControlNetUnionModel, AutoencoderKL
|
4 |
import gradio as gr
|
5 |
|
6 |
from pipeline.mod_controlnet_tile_sr_sdxl import StableDiffusionXLControlNetTileSRPipeline
|
@@ -10,7 +10,6 @@ from pipeline.util import (
|
|
10 |
calculate_overlap,
|
11 |
create_hdr_effect,
|
12 |
progressive_upscale,
|
13 |
-
quantize_8bit,
|
14 |
select_scheduler,
|
15 |
)
|
16 |
|
@@ -27,11 +26,7 @@ pipe = StableDiffusionXLControlNetTileSRPipeline.from_pretrained(
|
|
27 |
model_id, controlnet=controlnet, vae=vae, torch_dtype=torch.float16, use_safetensors=True, variant="fp16"
|
28 |
).to(device)
|
29 |
|
30 |
-
#
|
31 |
-
# quantize_8bit(unet) # << Enable this if you have limited VRAM
|
32 |
-
# pipe.unet = unet
|
33 |
-
|
34 |
-
#pipe.enable_model_cpu_offload() # << Enable this if you have limited VRAM
|
35 |
pipe.enable_vae_tiling() # << Enable this if you have limited VRAM
|
36 |
pipe.enable_vae_slicing() # << Enable this if you have limited VRAM
|
37 |
|
|
|
1 |
import torch
|
2 |
import spaces
|
3 |
+
from diffusers import ControlNetUnionModel, AutoencoderKL
|
4 |
import gradio as gr
|
5 |
|
6 |
from pipeline.mod_controlnet_tile_sr_sdxl import StableDiffusionXLControlNetTileSRPipeline
|
|
|
10 |
calculate_overlap,
|
11 |
create_hdr_effect,
|
12 |
progressive_upscale,
|
|
|
13 |
select_scheduler,
|
14 |
)
|
15 |
|
|
|
26 |
model_id, controlnet=controlnet, vae=vae, torch_dtype=torch.float16, use_safetensors=True, variant="fp16"
|
27 |
).to(device)
|
28 |
|
29 |
+
pipe.enable_model_cpu_offload() # << Enable this if you have limited VRAM
|
|
|
|
|
|
|
|
|
30 |
pipe.enable_vae_tiling() # << Enable this if you have limited VRAM
|
31 |
pipe.enable_vae_slicing() # << Enable this if you have limited VRAM
|
32 |
|