From cffe3c5bb45c0b9402c8c5a8e9c2ae7c4e986bc4 Mon Sep 17 00:00:00 2001 From: d8ahazard Date: Tue, 3 Jan 2023 10:47:54 -0600 Subject: [PATCH] Unload SD model on process start. --- smartprocess.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smartprocess.py b/smartprocess.py index 0332186..3ff3ac8 100644 --- a/smartprocess.py +++ b/smartprocess.py @@ -82,6 +82,7 @@ def preprocess(rename, scaler ): try: + shared.sd_model.to("cpu") shared.state.textinfo = "Initializing smart processing..." safe.RestrictedUnpickler = reallysafe.RestrictedUnpickler @@ -370,7 +371,10 @@ def preprocess(rename, if caption_wd14: printi("Unloading wd14 interrogator...") wd_interrogator.unload() - + try: + shared.sd_model.to(shared.device) + except: + pass return f"Successfully processed {len(files)} images.", f"Successfully processed {len(files)} images." except Exception as e: