From a208564f06d82cedfee6fa4f4b0a47dc09833035 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sat, 8 Oct 2022 12:35:23 +0530 Subject: [PATCH] Wait for the model to load before changing the global 'model loaded' state --- ui/sd_internal/runtime.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/sd_internal/runtime.py b/ui/sd_internal/runtime.py index 7c20eff9..8e0657a6 100644 --- a/ui/sd_internal/runtime.py +++ b/ui/sd_internal/runtime.py @@ -82,7 +82,6 @@ except: def load_model_ckpt(ckpt_to_use, device_to_use='cuda', turbo=False, unet_bs_to_use=1, precision_to_use='autocast'): global ckpt_file, model, modelCS, modelFS, model_is_half, device, unet_bs, precision, model_fs_is_half - ckpt_file = ckpt_to_use device = device_to_use if has_valid_gpu else 'cpu' precision = precision_to_use if not force_full_precision else 'full' unet_bs = unet_bs_to_use @@ -90,7 +89,7 @@ def load_model_ckpt(ckpt_to_use, device_to_use='cuda', turbo=False, unet_bs_to_u if device == 'cpu': precision = 'full' - sd = load_model_from_config(f"{ckpt_file}.ckpt") + sd = load_model_from_config(f"{ckpt_to_use}.ckpt") li, lo = [], [] for key, value in sd.items(): sp = key.split(".") @@ -137,6 +136,8 @@ def load_model_ckpt(ckpt_to_use, device_to_use='cuda', turbo=False, unet_bs_to_u model_is_half = False model_fs_is_half = False + ckpt_file = ckpt_to_use + print('loaded ', ckpt_file, 'to', device, 'precision', precision) def load_model_gfpgan(gfpgan_to_use):