Unverified Commit 5f5435eb authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub
Browse files

Merge pull request #10218 from micky2be/find_vae

Files in vae folder with same name as a checkpoint can be found too
parents 3ddc7634 80adb697
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -85,10 +85,10 @@ def refresh_vae_list():




def find_vae_near_checkpoint(checkpoint_file):
def find_vae_near_checkpoint(checkpoint_file):
    checkpoint_path = os.path.splitext(checkpoint_file)[0]
    checkpoint_path = os.path.basename(checkpoint_file).rsplit('.', 1)[0]
    for vae_location in [f"{checkpoint_path}.vae.pt", f"{checkpoint_path}.vae.ckpt", f"{checkpoint_path}.vae.safetensors"]:
    for vae_file in vae_dict.values():
        if os.path.isfile(vae_location):
        if os.path.basename(vae_file).startswith(checkpoint_path):
            return vae_location
            return vae_file


    return None
    return None