Display name of error latent file

When trying to load stored latents, if an error occurs, this change will tell you what file failed to load
Currently it will just tell you that something failed without telling you which file
This commit is contained in:
Cauldrath
2024-04-18 23:15:36 -04:00
parent 71e2c91330
commit feefcf256e

View File

@@ -2123,17 +2123,20 @@ def is_disk_cached_latents_is_expected(reso, npz_path: str, flip_aug: bool):
if not os.path.exists(npz_path): if not os.path.exists(npz_path):
return False return False
npz = np.load(npz_path) try:
if "latents" not in npz or "original_size" not in npz or "crop_ltrb" not in npz: # old ver? npz = np.load(npz_path)
return False if "latents" not in npz or "original_size" not in npz or "crop_ltrb" not in npz: # old ver?
if npz["latents"].shape[1:3] != expected_latents_size: return False
return False if npz["latents"].shape[1:3] != expected_latents_size:
return False
if flip_aug: if flip_aug:
if "latents_flipped" not in npz: if "latents_flipped" not in npz:
return False return False
if npz["latents_flipped"].shape[1:3] != expected_latents_size: if npz["latents_flipped"].shape[1:3] != expected_latents_size:
return False return False
except:
raise RuntimeError(f"Error loading file: {npz_path}")
return True return True