mirror of
https://github.com/nod-ai/AMD-SHARK-Studio.git
synced 2026-04-03 03:00:17 -04:00
Fix low vram mode issues (#1295)
- add ondemand back to img2img - workaround memory leak for batch count
This commit is contained in:
@@ -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 = ""
|
||||
|
||||
@@ -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 = ""
|
||||
|
||||
Reference in New Issue
Block a user