Skip to content

Incorrect buckets sizes are generated #476

@pcl04dl3tt3r

Description

@pcl04dl3tt3r

In experimenting with adding native qwen resolutions to the bucket sizes I discovered that the function get_bucket_sizes is adding new and incorrect resolutions to the buckets list. I believe this is due to a unintended type promotion. Basically the mod operations that check for matching width and height will rarely equal 0 because it is resulting in a float value. So, the comparison should instead use a very small value close to zero or the int type should be explicit.

The result is that this function adds new resolution buckets with often wildly different aspect ratios than the input image. Images that should in fact match an existing resolution will end up in a bucket for the newly added resolution.

I am assuming this may have some affect on training quality.

def get_bucket_sizes(resolution: int = 512, divisibility: int = 8) -> List[BucketResolution]:

Edit:

In other words, if I create a dataset where all the images conform to a standard SDXL width and height, they will still get put in random buckets and resized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions