speed up getting image sizes

This commit is contained in:
Kohya S
2024-08-22 22:02:29 +09:00
parent 99744af53a
commit 81411a398e
5 changed files with 38 additions and 22 deletions

View File

@@ -204,9 +204,14 @@ class LatentsCachingStrategy:
def batch_size(self):
return self._batch_size
def get_image_size_from_disk_cache_path(self, absolute_path: str) -> Tuple[Optional[int], Optional[int]]:
@property
def cache_suffix(self):
raise NotImplementedError
def get_image_size_from_disk_cache_path(self, absolute_path: str, npz_path: str) -> Tuple[Optional[int], Optional[int]]:
w, h = os.path.splitext(npz_path)[0].split("_")[-2].split("x")
return int(w), int(h)
def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[int, int]) -> str:
raise NotImplementedError