diff --git a/modules/modelloader.py b/modules/modelloader.py index 974a4b1a5..8146620c5 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -449,14 +449,19 @@ def load_upscalers(): used_classes[classname] = cls upscaler_types = [] for cls in reversed(used_classes.values()): - name = cls.__name__ - cmd_name = f"{name.lower().replace('upscaler', '')}_models_path" - commandline_model_path = commandline_options.get(cmd_name, None) - scaler = cls(commandline_model_path) - scaler.user_path = commandline_model_path - scaler.model_download_path = commandline_model_path or scaler.model_path - upscalers += scaler.scalers - upscaler_types.append(name[8:]) + try: + name = cls.__name__ + cmd_name = f"{name.lower().replace('upscaler', '')}_models_path" + commandline_model_path = commandline_options.get(cmd_name, None) + scaler = cls(commandline_model_path) + scaler.user_path = commandline_model_path + scaler.model_download_path = commandline_model_path or scaler.model_path + upscalers += scaler.scalers + upscaler_types.append(name[8:]) + except Exception as e: + log.error(f'Upscaler: {cls} {e}') + if len(upscalers) == 0: + log.error('Upscalers: no data') shared.sd_upscalers = upscalers t1 = time.time() log.info(f"Available Upscalers: items={len(shared.sd_upscalers)} downloaded={len([x for x in shared.sd_upscalers if x.data_path is not None and os.path.isfile(x.data_path)])} user={len([x for x in shared.sd_upscalers if x.custom])} time={t1-t0:.2f} types={upscaler_types}") diff --git a/modules/ui_sections.py b/modules/ui_sections.py index 09108d716..630c7be76 100644 --- a/modules/ui_sections.py +++ b/modules/ui_sections.py @@ -365,6 +365,8 @@ def create_resize_inputs(tab, images, accordion=True, latent=False, non_zero=Tru with gr.Accordion(open=False, label="Resize", elem_classes=["small-accordion"], elem_id=f"{tab}_resize_group") if accordion else gr.Group(): with gr.Row(): available_upscalers = [x.name for x in shared.sd_upscalers] + if len(available_upscalers) == 0: + available_upscalers = ['None'] if not latent: available_upscalers = [x for x in available_upscalers if not x.lower().startswith('latent')] resize_mode = gr.Dropdown(label=f"Mode{prefix}" if non_zero else "Resize mode", elem_id=f"{tab}_resize_mode", choices=shared.resize_modes, type="index", value='Fixed')