From 48c0ce9b2b46aec36a0c722eef92733a4a21793d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 27 Aug 2023 08:01:29 +0000 Subject: [PATCH] fix model lookups --- modules/devices.py | 3 +-- modules/sd_models.py | 4 ++-- modules/shared.py | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/devices.py b/modules/devices.py index cb29e6e3b..c1d49dd3d 100644 --- a/modules/devices.py +++ b/modules/devices.py @@ -73,8 +73,7 @@ def torch_gc(force=False): if backend == "directml": practical_used = round(100 * torch.cuda.memory_allocated() / (1 << 30) / gpu.get('total', 1)) shared.log.info(f'Practical GPU memory utilization: {practical_used}%') - - if shared.opts.disable_gc and not force: + if not force: return collected = gc.collect() if cuda_ok: diff --git a/modules/sd_models.py b/modules/sd_models.py index de3d97b6c..83d8748cc 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -491,7 +491,7 @@ class ModelData: self.lock = threading.Lock() def get_sd_model(self): - if self.sd_model is None: + if self.sd_model is None and shared.opts.sd_model_checkpoint != 'None': with self.lock: try: if shared.backend == shared.Backend.ORIGINAL: @@ -511,7 +511,7 @@ class ModelData: self.sd_model = v def get_sd_refiner(self): - if self.sd_refiner is None: + if self.sd_refiner is None and shared.opts.sd_model_refiner != 'None': with self.lock: try: if shared.backend == shared.Backend.ORIGINAL: diff --git a/modules/shared.py b/modules/shared.py index 1a3fc2c9b..588becd05 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -398,7 +398,6 @@ options_templates.update(options_section(('cuda', "Compute Settings"), { "cuda_compile_precompile": OptionInfo(False, "Model compile precompile"), "cuda_compile_verbose": OptionInfo(False, "Model compile verbose mode"), "cuda_compile_errors": OptionInfo(True, "Model compile suppress errors"), - "disable_gc": OptionInfo(True, "Disable Torch memory garbage collection"), "ipex_optimize": OptionInfo(True if devices.backend == "ipex" else False, "Enable IPEX Optimize for Intel GPUs"), "directml_memory_provider": OptionInfo(default_memory_provider, '[DirectML] Memory stats provider', gr.Dropdown, lambda: {"choices": memory_providers}), }))