diff options
author | Zac Liu <liuguang@baai.ac.cn> | 2022-12-06 01:16:15 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 01:16:15 +0000 |
commit | 3ebf977a6e4f478ab918e44506974beee32da276 (patch) | |
tree | f68456207e5cd78718ec1e9c588ecdc22d568d81 /modules/modelloader.py | |
parent | 231fb72872191ffa8c446af1577c9003b3d19d4f (diff) | |
parent | 44c46f0ed395967cd3830dd481a2db759fda5b3b (diff) | |
download | stable-diffusion-webui-gfx803-3ebf977a6e4f478ab918e44506974beee32da276.tar.gz stable-diffusion-webui-gfx803-3ebf977a6e4f478ab918e44506974beee32da276.tar.bz2 stable-diffusion-webui-gfx803-3ebf977a6e4f478ab918e44506974beee32da276.zip |
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'modules/modelloader.py')
-rw-r--r-- | modules/modelloader.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/modules/modelloader.py b/modules/modelloader.py index 7d2f0ade..e647f6fa 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -124,10 +124,9 @@ def move_files(src_path: str, dest_path: str, ext_filter: str = None): def load_upscalers(): - sd = shared.script_path # We can only do this 'magic' method to dynamically load upscalers if they are referenced, # so we'll try to import any _model.py files before looking in __subclasses__ - modules_dir = os.path.join(sd, "modules") + modules_dir = os.path.join(shared.script_path, "modules") for file in os.listdir(modules_dir): if "_model.py" in file: model_name = file.replace("_model.py", "") @@ -136,22 +135,13 @@ def load_upscalers(): importlib.import_module(full_model) except: pass + datas = [] - c_o = vars(shared.cmd_opts) + commandline_options = vars(shared.cmd_opts) for cls in Upscaler.__subclasses__(): name = cls.__name__ - module_name = cls.__module__ - module = importlib.import_module(module_name) - class_ = getattr(module, name) cmd_name = f"{name.lower().replace('upscaler', '')}_models_path" - opt_string = None - try: - if cmd_name in c_o: - opt_string = c_o[cmd_name] - except: - pass - scaler = class_(opt_string) - for child in scaler.scalers: - datas.append(child) + scaler = cls(commandline_options.get(cmd_name, None)) + datas += scaler.scalers shared.sd_upscalers = datas |