From 0dce0df1ee63b2f158805c1a1f1a3743cc4a104b Mon Sep 17 00:00:00 2001 From: d8ahazard Date: Thu, 29 Sep 2022 17:46:23 -0500 Subject: Holy $hit. Yep. Fix gfpgan_model_arch requirement(s). Add Upscaler base class, move from images. Add a lot of methods to Upscaler. Re-work all the child upscalers to be proper classes. Add BSRGAN scaler. Add ldsr_model_arch class, removing the dependency for another repo that just uses regular latent-diffusion stuff. Add one universal method that will always find and load new upscaler models without having to add new "setup_model" calls. Still need to add command line params, but that could probably be automated. Add a "self.scale" property to all Upscalers so the scalers themselves can do "things" in response to the requested upscaling size. Ensure LDSR doesn't get stuck in a longer loop of "upscale/downscale/upscale" as we try to reach the target upscale size. Add typehints for IDE sanity. PEP-8 improvements. Moar. --- webui.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'webui.py') diff --git a/webui.py b/webui.py index 76d392a2..be1bc769 100644 --- a/webui.py +++ b/webui.py @@ -1,9 +1,10 @@ import os import signal import threading - +import modules.paths import modules.codeformer_model as codeformer import modules.esrgan_model as esrgan +import modules.bsrgan_model as bsrgan import modules.extras import modules.face_restoration import modules.gfpgan_model as gfpgan @@ -27,11 +28,7 @@ modules.sd_models.setup_model(cmd_opts.stablediffusion_models_path) codeformer.setup_model(cmd_opts.codeformer_models_path) gfpgan.setup_model(cmd_opts.gfpgan_models_path) shared.face_restorers.append(modules.face_restoration.FaceRestoration()) - -esrgan.setup_model(cmd_opts.esrgan_models_path) -swinir.setup_model(cmd_opts.swinir_models_path) -realesrgan.setup_model(cmd_opts.realesrgan_models_path) -ldsr.setup_model(cmd_opts.ldsr_models_path) +modelloader.load_upscalers() queue_lock = threading.Lock() -- cgit v1.2.3