Spaces:
Build error
Build error
Commit ·
76e1dc2
1
Parent(s): c721d8e
update
Browse files
app.py
CHANGED
|
@@ -48,9 +48,9 @@ base_model_path = "data/ckpt/realisticVisionV60B1_v51VAE"
|
|
| 48 |
# input brushnet ckpt path
|
| 49 |
brushnet_path = "data/ckpt/segmentation_mask_brushnet_ckpt"
|
| 50 |
|
| 51 |
-
brushnet = BrushNetModel.from_pretrained(brushnet_path, torch_dtype=torch.float16)
|
| 52 |
pipe = StableDiffusionBrushNetPipeline.from_pretrained(
|
| 53 |
-
base_model_path, brushnet=brushnet, torch_dtype=torch.float16, low_cpu_mem_usage=False
|
| 54 |
)
|
| 55 |
|
| 56 |
# speed up diffusion process with faster scheduler and memory optimization
|
|
@@ -58,7 +58,7 @@ pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
|
| 58 |
# remove following line if xformers is not installed or when using Torch 2.0.
|
| 59 |
# pipe.enable_xformers_memory_efficient_attention()
|
| 60 |
# memory optimization.
|
| 61 |
-
pipe.enable_model_cpu_offload()
|
| 62 |
|
| 63 |
def resize_image(input_image, resolution):
|
| 64 |
H, W, C = input_image.shape
|
|
|
|
| 48 |
# input brushnet ckpt path
|
| 49 |
brushnet_path = "data/ckpt/segmentation_mask_brushnet_ckpt"
|
| 50 |
|
| 51 |
+
brushnet = BrushNetModel.from_pretrained(brushnet_path, torch_dtype=torch.float16, device=DEVICE)
|
| 52 |
pipe = StableDiffusionBrushNetPipeline.from_pretrained(
|
| 53 |
+
base_model_path, brushnet=brushnet, torch_dtype=torch.float16, low_cpu_mem_usage=False, device=DEVICE
|
| 54 |
)
|
| 55 |
|
| 56 |
# speed up diffusion process with faster scheduler and memory optimization
|
|
|
|
| 58 |
# remove following line if xformers is not installed or when using Torch 2.0.
|
| 59 |
# pipe.enable_xformers_memory_efficient_attention()
|
| 60 |
# memory optimization.
|
| 61 |
+
pipe.enable_model_cpu_offload(device=DEVICE)
|
| 62 |
|
| 63 |
def resize_image(input_image, resolution):
|
| 64 |
H, W, C = input_image.shape
|