Skip to content

Commit 7802093

Browse files
authoredMay 12, 2024
Merge pull request kohya-ss#1278 from Cauldrath/catch_latent_error_file
Display name of error latent file
2 parents 9ddb4d7 + 040e26f commit 7802093

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed
 

‎library/train_util.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -2123,18 +2123,23 @@ def is_disk_cached_latents_is_expected(reso, npz_path: str, flip_aug: bool):
21232123
if not os.path.exists(npz_path):
21242124
return False
21252125

2126-
npz = np.load(npz_path)
2127-
if "latents" not in npz or "original_size" not in npz or "crop_ltrb" not in npz: # old ver?
2128-
return False
2129-
if npz["latents"].shape[1:3] != expected_latents_size:
2130-
return False
2131-
2132-
if flip_aug:
2133-
if "latents_flipped" not in npz:
2126+
try:
2127+
npz = np.load(npz_path)
2128+
if "latents" not in npz or "original_size" not in npz or "crop_ltrb" not in npz: # old ver?
21342129
return False
2135-
if npz["latents_flipped"].shape[1:3] != expected_latents_size:
2130+
if npz["latents"].shape[1:3] != expected_latents_size:
21362131
return False
21372132

2133+
if flip_aug:
2134+
if "latents_flipped" not in npz:
2135+
return False
2136+
if npz["latents_flipped"].shape[1:3] != expected_latents_size:
2137+
return False
2138+
except Exception as e:
2139+
print(npz_path)
2140+
print(e)
2141+
return False
2142+
21382143
return True
21392144

21402145

0 commit comments

Comments
 (0)