mirror of
https://github.com/nod-ai/AMD-SHARK-Studio.git
synced 2026-04-03 03:00:17 -04:00
Unload clip on demand and workaround memory leak (#1283)
This commit is contained in:
@@ -170,7 +170,8 @@ def img2img_inf(
|
||||
use_stencil=use_stencil,
|
||||
)
|
||||
if (
|
||||
not global_obj.get_sd_obj()
|
||||
args.ondemand
|
||||
or not global_obj.get_sd_obj()
|
||||
or global_obj.get_cfg_obj() != new_config_obj
|
||||
):
|
||||
global_obj.clear_cache()
|
||||
@@ -239,6 +240,7 @@ def img2img_inf(
|
||||
)
|
||||
|
||||
global_obj.set_sd_scheduler(args.scheduler)
|
||||
global_obj.set_sd_ondemand(args.ondemand)
|
||||
|
||||
start_time = time.time()
|
||||
global_obj.get_sd_obj().log = ""
|
||||
|
||||
@@ -103,7 +103,8 @@ def inpaint_inf(
|
||||
use_stencil=None,
|
||||
)
|
||||
if (
|
||||
not global_obj.get_sd_obj()
|
||||
args.ondemand
|
||||
or not global_obj.get_sd_obj()
|
||||
or global_obj.get_cfg_obj() != new_config_obj
|
||||
):
|
||||
global_obj.clear_cache()
|
||||
@@ -148,6 +149,7 @@ 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 = ""
|
||||
|
||||
@@ -65,6 +65,9 @@ def outpaint_inf(
|
||||
args.steps = steps
|
||||
args.scheduler = scheduler
|
||||
args.img_path = "not none"
|
||||
if ondemand:
|
||||
print("Outpainting is not supporting ondemand yet.")
|
||||
ondemand = False
|
||||
args.ondemand = ondemand
|
||||
|
||||
# set ckpt_loc and hf_model_id.
|
||||
|
||||
@@ -103,7 +103,8 @@ def upscaler_inf(
|
||||
use_stencil=None,
|
||||
)
|
||||
if (
|
||||
not global_obj.get_sd_obj()
|
||||
args.ondemand
|
||||
or not global_obj.get_sd_obj()
|
||||
or global_obj.get_cfg_obj() != new_config_obj
|
||||
):
|
||||
global_obj.clear_cache()
|
||||
@@ -146,6 +147,7 @@ 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