Small tweaks and fixes for specialized ip adapter training

This commit is contained in:
Jaret Burkett
2024-03-26 11:35:26 -06:00
parent 9c1cc9641e
commit 427847ac4c
6 changed files with 117 additions and 11 deletions

View File

@@ -728,6 +728,12 @@ class ClipImageFileItemDTOMixin:
# do a flip
img = img.transpose(Image.FLIP_TOP_BOTTOM)
# image must be square. If it is not, we will resize/squish it so it is, that way we don't crop out data
if img.width != img.height:
# resize to the smallest dimension
min_size = min(img.width, img.height)
img = img.resize((min_size, min_size), Image.BICUBIC)
if self.has_clip_augmentations:
self.clip_image_tensor = self.augment_clip_image(img, transform=None)
else: