Fix low vram mode issues (#1295)

- add ondemand back to img2img
- workaround memory leak for batch count
This commit is contained in:
jinchen62
2023-04-11 17:59:09 -07:00
committed by GitHub
parent f17915bedc
commit 428cfe8dae
6 changed files with 19 additions and 9 deletions

View File

@@ -64,6 +64,9 @@ def inpaint_inf(
args.img_path = "not none"
args.mask_path = "not none"
args.ondemand = ondemand
if ondemand and batch_count > 1:
print("Low VRAM mode currently only supports 1 batch count.")
batch_count = 1
# set ckpt_loc and hf_model_id.
args.ckpt_loc = ""
@@ -101,6 +104,7 @@ def inpaint_inf(
device,
use_lora=args.use_lora,
use_stencil=None,
ondemand=ondemand,
)
if (
args.ondemand
@@ -149,7 +153,6 @@ def inpaint_inf(
)
global_obj.set_sd_scheduler(scheduler)
global_obj.set_sd_ondemand(args.ondemand)
start_time = time.time()
global_obj.get_sd_obj().log = ""

View File

@@ -58,6 +58,9 @@ def upscaler_inf(
args.steps = steps
args.scheduler = scheduler
args.ondemand = ondemand
if ondemand and batch_count > 1:
print("Low VRAM mode currently only supports 1 batch count.")
batch_count = 1
if init_image is None:
return None, "An Initial Image is required"
@@ -101,6 +104,7 @@ def upscaler_inf(
device,
use_lora=args.use_lora,
use_stencil=None,
ondemand=ondemand,
)
if (
args.ondemand
@@ -147,7 +151,6 @@ def upscaler_inf(
global_obj.get_sd_obj().low_res_scheduler = global_obj.get_scheduler(
"DDPM"
)
global_obj.set_sd_ondemand(args.ondemand)
start_time = time.time()
global_obj.get_sd_obj().log = ""