Update sd_vae.py

Removed pathlib, but had to retain '+ ".vae.pt"' etc, otherwise it was adding a separator between the filename and the extension
This commit is contained in:
Gazzoo-byte
2023-04-26 00:07:42 +01:00
committed by GitHub
parent b6354950c2
commit 97e8224200
+1 -2
View File
@@ -5,7 +5,6 @@ from copy import deepcopy
from rich import print # pylint: disable=redefined-builtin
import torch
from modules import paths, shared, devices, script_callbacks, sd_models
from pathlib import Path
vae_ignore_keys = {"model_ema.decay", "model_ema.num_updates"}
@@ -103,7 +102,7 @@ def resolve_vae(checkpoint_file):
return vae_near_checkpoint, 'found near the checkpoint'
if is_automatic:
for named_vae_location in [vae_path + os.sep + Path(checkpoint_file).stem + ".vae.pt", vae_path + os.sep + Path(checkpoint_file).stem + ".vae.ckpt", vae_path + os.sep + Path(checkpoint_file).stem + ".vae.safetensors"]:
for named_vae_location in [os.path.join(vae_path, os.path.splitext(os.path.basename(checkpoint_file))[0] + ".vae.pt"), os.path.join(vae_path, os.path.splitext(os.path.basename(checkpoint_file))[0] + ".vae.ckpt"), os.path.join(vae_path, os.path.splitext(os.path.basename(checkpoint_file))[0] + ".vae.safetensors")]:
if os.path.isfile(named_vae_location):
print(named_vae_location+' found in VAE dir')
return named_vae_location, ' found in VAE dir'