diff options
author | Muhammad Rizqi Nur <rizqinur2010@gmail.com> | 2022-11-19 08:21:00 +0000 |
---|---|---|
committer | Muhammad Rizqi Nur <rizqinur2010@gmail.com> | 2022-11-19 08:21:00 +0000 |
commit | 45dca0562e0a68d2f92a5b6fe0412dcd8ba0659e (patch) | |
tree | fe4131dd0f3251022c62120a5ef6bf79fa1242a3 /modules/sd_vae.py | |
parent | 028b67b6357b5a00ccbd6ea72d2f244a6664162b (diff) | |
parent | d9fd4525a5d684100997130cc4132736bab1e4d9 (diff) | |
download | stable-diffusion-webui-gfx803-45dca0562e0a68d2f92a5b6fe0412dcd8ba0659e.tar.gz stable-diffusion-webui-gfx803-45dca0562e0a68d2f92a5b6fe0412dcd8ba0659e.tar.bz2 stable-diffusion-webui-gfx803-45dca0562e0a68d2f92a5b6fe0412dcd8ba0659e.zip |
Merge branch 'a1111' into vae-fix-none
Diffstat (limited to 'modules/sd_vae.py')
-rw-r--r-- | modules/sd_vae.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/modules/sd_vae.py b/modules/sd_vae.py index d82a7bad..a6310a2e 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -87,7 +87,19 @@ def refresh_vae_list(vae_path=vae_path, model_path=model_path): return vae_list -def resolve_vae(checkpoint_file, vae_file="auto"): +def get_vae_from_settings(vae_file="auto"): + # else, we load from settings, if not set to be default + if vae_file == "auto" and shared.opts.sd_vae is not None: + # if saved VAE settings isn't recognized, fallback to auto + vae_file = vae_dict.get(shared.opts.sd_vae, "auto") + # if VAE selected but not found, fallback to auto + if vae_file not in default_vae_values and not os.path.isfile(vae_file): + vae_file = "auto" + print("Selected VAE doesn't exist") + return vae_file + + +def resolve_vae(checkpoint_file=None, vae_file="auto"): global first_load, vae_dict, vae_list # if vae_file argument is provided, it takes priority, but not saved @@ -102,14 +114,9 @@ def resolve_vae(checkpoint_file, vae_file="auto"): shared.opts.data['sd_vae'] = get_filename(vae_file) else: print("VAE provided as command line argument doesn't exist") - # else, we load from settings - if vae_file == "auto" and shared.opts.sd_vae is not None: - # if saved VAE settings isn't recognized, fallback to auto - vae_file = vae_dict.get(shared.opts.sd_vae, "auto") - # if VAE selected but not found, fallback to auto - if vae_file not in default_vae_values and not os.path.isfile(vae_file): - vae_file = "auto" - print("Selected VAE doesn't exist") + # fallback to selector in settings, if vae selector not set to act as default fallback + if not shared.opts.sd_vae_as_default: + vae_file = get_vae_from_settings(vae_file) # vae-path cmd arg takes priority for auto if vae_file == "auto" and shared.cmd_opts.vae_path is not None: if os.path.isfile(shared.cmd_opts.vae_path): |