Make some changes to try and fix out of memory issue.
Browse files
app.py
CHANGED
@@ -38,7 +38,9 @@ pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
|
|
38 |
safety_checker=None,
|
39 |
torch_dtype=torch.float16,
|
40 |
).to("cuda")
|
41 |
-
|
|
|
|
|
42 |
|
43 |
|
44 |
def resize_for_condition_image(input_image: Image.Image, resolution: int, canvas_width: int = None, canvas_height: int = None):
|
@@ -319,5 +321,6 @@ model: https://huggingface.co/DionTimmer/controlnet_qrcode-control_v1p_sd15
|
|
319 |
cache_examples=True,
|
320 |
)
|
321 |
|
|
|
322 |
blocks.queue(max_size=20,api_open=False)
|
323 |
blocks.launch(share=bool(os.environ.get("SHARE", False)), show_api=False)
|
|
|
38 |
safety_checker=None,
|
39 |
torch_dtype=torch.float16,
|
40 |
).to("cuda")
|
41 |
+
pipe.enable_xformers_memory_efficient_attention()
|
42 |
+
pipe.controlnet = torch.nn.DataParallel(pipe.controlnet)
|
43 |
+
pipe.unet = torch.nn.DataParallel(pipe.unet)
|
44 |
|
45 |
|
46 |
def resize_for_condition_image(input_image: Image.Image, resolution: int, canvas_width: int = None, canvas_height: int = None):
|
|
|
321 |
cache_examples=True,
|
322 |
)
|
323 |
|
324 |
+
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
325 |
blocks.queue(max_size=20,api_open=False)
|
326 |
blocks.launch(share=bool(os.environ.get("SHARE", False)), show_api=False)
|