From 7fd3a4e6d7b1c70461eed0c8a7dc4f2412cdaf1c Mon Sep 17 00:00:00 2001 From: Micky Brunetti Date: Tue, 9 May 2023 15:35:57 +0200 Subject: files in vae folder with same name as a checkpoint can be found too --- modules/sd_vae.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/sd_vae.py b/modules/sd_vae.py index 9b00f76e..4d2026e1 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -88,10 +88,13 @@ def refresh_vae_list(): def find_vae_near_checkpoint(checkpoint_file): - checkpoint_path = os.path.splitext(checkpoint_file)[0] - for vae_location in [checkpoint_path + ".vae.pt", checkpoint_path + ".vae.ckpt", checkpoint_path + ".vae.safetensors"]: - if os.path.isfile(vae_location): - return vae_location + checkpoint_path = os.path.basename(checkpoint_file).split('.', 1)[0] + print(f"checkpoint: {checkpoint_path}") + for vae_file in vae_dict.values(): + vae_path = os.path.basename(vae_file).split('.', 1)[0] + print(f"vae: {vae_path}") + if vae_path == checkpoint_path: + return vae_file return None -- cgit v1.2.1 From 749a93295e5259fbba2e2a849cde5a37c67aa69f Mon Sep 17 00:00:00 2001 From: Micky Brunetti Date: Tue, 9 May 2023 15:43:58 +0200 Subject: remove logs --- modules/sd_vae.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'modules') diff --git a/modules/sd_vae.py b/modules/sd_vae.py index 4d2026e1..17d1f702 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -89,10 +89,8 @@ def refresh_vae_list(): def find_vae_near_checkpoint(checkpoint_file): checkpoint_path = os.path.basename(checkpoint_file).split('.', 1)[0] - print(f"checkpoint: {checkpoint_path}") for vae_file in vae_dict.values(): vae_path = os.path.basename(vae_file).split('.', 1)[0] - print(f"vae: {vae_path}") if vae_path == checkpoint_path: return vae_file -- cgit v1.2.1 From 1dcd6723242c3d691610f9ed937951baea49c2d1 Mon Sep 17 00:00:00 2001 From: Sakura-Luna <53183413+Sakura-Luna@users.noreply.github.com> Date: Thu, 11 May 2023 14:29:52 +0800 Subject: Update sd_vae.py There is no need to use split. --- modules/sd_vae.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/sd_vae.py b/modules/sd_vae.py index 17d1f702..95262ca3 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -88,10 +88,9 @@ def refresh_vae_list(): def find_vae_near_checkpoint(checkpoint_file): - checkpoint_path = os.path.basename(checkpoint_file).split('.', 1)[0] + checkpoint_path = os.path.basename(checkpoint_file).rsplit('.', 1)[0] for vae_file in vae_dict.values(): - vae_path = os.path.basename(vae_file).split('.', 1)[0] - if vae_path == checkpoint_path: + if os.path.basename(vae_file).startswith(checkpoint_path): return vae_file return None -- cgit v1.2.1