Fixed issues with dataloader bucketing. Allow using standard base image for t2i adapters.
This commit is contained in:
@@ -83,7 +83,8 @@ def get_bucket_for_image_size(
|
||||
width: int,
|
||||
height: int,
|
||||
bucket_size_list: List[BucketResolution] = None,
|
||||
resolution: Union[int, None] = None
|
||||
resolution: Union[int, None] = None,
|
||||
divisibility: int = 8
|
||||
) -> BucketResolution:
|
||||
|
||||
if bucket_size_list is None and resolution is None:
|
||||
@@ -93,7 +94,7 @@ def get_bucket_for_image_size(
|
||||
# if real resolution is smaller, use that instead
|
||||
real_resolution = get_resolution(width, height)
|
||||
resolution = min(resolution, real_resolution)
|
||||
bucket_size_list = get_bucket_sizes(resolution=resolution)
|
||||
bucket_size_list = get_bucket_sizes(resolution=resolution, divisibility=divisibility)
|
||||
|
||||
# Check for exact match first
|
||||
for bucket in bucket_size_list:
|
||||
|
||||
@@ -281,7 +281,8 @@ class PairedImageDataset(Dataset):
|
||||
bucket_resolution = get_bucket_for_image_size(
|
||||
width=img2.width,
|
||||
height=img2.height,
|
||||
resolution=self.size
|
||||
resolution=self.size,
|
||||
# divisibility=self.
|
||||
)
|
||||
|
||||
# images will be same base dimension, but may be trimmed. We need to shrink and then central crop
|
||||
|
||||
@@ -121,7 +121,7 @@ class BucketsMixin:
|
||||
width = file_item.crop_width
|
||||
height = file_item.crop_height
|
||||
|
||||
bucket_resolution = get_bucket_for_image_size(width, height, resolution=resolution)
|
||||
bucket_resolution = get_bucket_for_image_size(width, height, resolution=resolution, divisibility=bucket_tolerance)
|
||||
|
||||
# set the scaling height and with to match smallest size, and keep aspect ratio
|
||||
if width > height:
|
||||
|
||||
Reference in New Issue
Block a user