diff --git a/modules/options.py b/modules/options.py index b0b56614..6958d97d 100644 --- a/modules/options.py +++ b/modules/options.py @@ -214,21 +214,6 @@ class Options: self.data = json.load(file) except FileNotFoundError: self.data = {} - except Exception: - errors.report(f'\nCould not load settings\nThe config file "{filename}" is likely corrupted\nIt has been moved to the "tmp/config.json"\nReverting config to default\n\n''', exc_info=True) - os.replace(filename, os.path.join(script_path, "tmp", "config.json")) - self.data = {} - # 1.6.0 VAE defaults - if self.data.get('sd_vae_as_default') is not None and self.data.get('sd_vae_overrides_per_model_preferences') is None: - self.data['sd_vae_overrides_per_model_preferences'] = not self.data.get('sd_vae_as_default') - - # 1.1.1 quicksettings list migration - if self.data.get('quicksettings') is not None and self.data.get('quicksettings_list') is None: - self.data['quicksettings_list'] = [i.strip() for i in self.data.get('quicksettings').split(',')] - - # 1.4.0 ui_reorder - if isinstance(self.data.get('ui_reorder'), str) and self.data.get('ui_reorder') and "ui_reorder_list" not in self.data: - self.data['ui_reorder_list'] = [i.strip() for i in self.data.get('ui_reorder').split(',')] bad_settings = 0 for k, v in self.data.items(): diff --git a/modules/processing.py b/modules/processing.py index 8ea118ab..7764f5e2 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -802,7 +802,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed: if sd_models.checkpoint_aliases.get(p.override_settings.get("sd_model_checkpoint")) is None: p.override_settings.pop("sd_model_checkpoint", None) - _vae_override: tuple[str, list[str]] = p.override_settings.pop("sd_vae", None) + _vae_override = p.override_settings.pop("sd_vae", None) # apply any options overrides set_config(p.override_settings, is_api=True, run_callbacks=False, save_config=False) @@ -814,10 +814,11 @@ def process_images(p: StableDiffusionProcessing) -> Processed: else: manage_model_and_prompt_cache(p) if _vae_override is not None: - override, choices = _vae_override + override: str = _vae_override + all_vae: list[str] = sd_vae.vae_dict.keys() _orig: list[str] = shared.opts.forge_additional_modules.copy() for i in range(len(_orig)): - if os.path.basename(_orig[i]) in choices: + if os.path.basename(_orig[i]) in all_vae: if _orig[i] != override: shared.opts.forge_additional_modules.pop(i) else: diff --git a/modules/sd_vae.py b/modules/sd_vae.py index 9827d5d8..50e0d893 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -91,7 +91,7 @@ def refresh_vae_list(): def reload_vae_weights(vae: str) -> bool: - if vae in (None, "None", "Automatic"): + if vae in (None, "None"): return False store_base_vae(shared.sd_model) diff --git a/modules/shared_options.py b/modules/shared_options.py index 40f6ffd6..42f5fcb4 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -263,7 +263,6 @@ image to and from latent space representation. Latent space is what Stable Diffu to create the resulting image after the sampling is finished. For img2img, VAE is additionally used to process user's input image before the sampling. """), "sd_vae": OptionInfo("Automatic", "SD VAE", gr.Dropdown, {"choices": ("Automatic",), "interactive": False}), - "sd_vae_overrides_per_model_preferences": OptionInfo(True, '"SD VAE" option overrides per-model preference'), "sd_vae_encode_method": OptionInfo("Full", "VAE for Encoding", gr.Radio, {"choices": ("Full", "TAESD")}, infotext="VAE Encoder").info("method to encode image to latent (img2img / Hires. fix / inpaint)"), "sd_vae_decode_method": OptionInfo("Full", "VAE for Decoding", gr.Radio, {"choices": ("Full", "TAESD")}, infotext="VAE Decoder").info("method to decode latent to image"), }, diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 5372493d..1327984f 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -115,8 +115,8 @@ def apply_size(p: StableDiffusionProcessing, x: str, _): logger.error(f'Invalid Size "{x}" for X/Y/Z Plot') -def apply_vae(p: StableDiffusionProcessing, x: str, xs: list[str]): - p.override_settings["sd_vae"] = (find_vae(x), xs) +def apply_vae(p: StableDiffusionProcessing, x: str, _): + p.override_settings["sd_vae"] = find_vae(x) def apply_styles(p: StableDiffusionProcessing, x: str, _): @@ -197,10 +197,8 @@ def refresh_loading_params_for_xyz_grid(): def find_vae(name: str) -> str: - if name is None or name.strip().lower() == "none": + if name in (None, "None"): return "None" - elif name.strip().lower() in ("auto", "automatic"): - return "Automatic" else: return sd_vae.vae_dict[name] @@ -301,7 +299,7 @@ axis_options = [ AxisOptionImg2Img("Sampler", str, apply_field("sampler_name"), format_value=format_value, confirm=confirm_samplers, choices=lambda: [x.name for x in sd_samplers.samplers_for_img2img if x.name not in opts.hide_samplers]), AxisOption("Schedule type", str, apply_field("scheduler"), choices=lambda: [x.label for x in sd_schedulers.schedulers]), AxisOption("Checkpoint name", str, apply_checkpoint, format_value=format_remove_path, confirm=confirm_checkpoints, cost=1.0, choices=lambda: sorted(sd_models.checkpoints_list, key=str.casefold)), - AxisOption("VAE", str, apply_vae, cost=0.7, choices=lambda: ["Automatic", "None"] + list(sd_vae.vae_dict)), + AxisOption("VAE", str, apply_vae, cost=0.7, choices=lambda: ["None", *sorted(sd_vae.vae_dict.keys())]), AxisOption("Clip skip", int, apply_override("CLIP_stop_at_last_layers")), AxisOption("Denoising", float, apply_field("denoising_strength")), AxisOption("Initial noise multiplier", float, apply_field("initial_noise_multiplier")),