Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ControlNET SDXL - bucketing ? #98

Closed
alelordelo opened this issue Nov 23, 2023 · 4 comments
Closed

ControlNET SDXL - bucketing ? #98

alelordelo opened this issue Nov 23, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@alelordelo
Copy link

Does the ControlNET SDXL training support bucketing for images with multi resolution and aspect ratio?

@alelordelo alelordelo added the help wanted Extra attention is needed label Nov 23, 2023
@okotaku
Copy link
Owner

okotaku commented Nov 28, 2023

@alelordelo Yes!
You can change this line https://github.com/okotaku/diffengine/blob/main/configs/_base_/datasets/fill50k_controlnet_xl.py#L1-L28 .

train_pipeline = [
    dict(type="SaveImageShape"),
    dict(
        type="MultiAspectRatioResizeCenterCrop",
        sizes=[
             [640, 1536], [768, 1344], [832, 1216], [896, 1152],
             [1024, 1024], [1152, 896], [1216, 832], [1344, 768], [1536, 640]
             ],
        interpolation='bilinear',
        keys=["img", "condition_img"]),
    dict(type="RandomHorizontalFlip", p=0.5, keys=["img", "condition_img"]),
    dict(type="ComputeTimeIds"),
    dict(type="torchvision/ToTensor", keys=["img", "condition_img"]),
    dict(type="DumpImage", max_imgs=10, dump_dir="work_dirs/dump"),
    dict(type="torchvision/Normalize", mean=[0.5], std=[0.5]),
    dict(
        type="PackInputs",
        input_keys=["img", "condition_img", "text", "time_ids"]),
]
train_dataloader = dict(
    batch_size=2,
    num_workers=4,
    dataset=dict(
        type="HFControlNetDataset",
        dataset="fusing/fill50k",
        condition_column="conditioning_image",
        caption_column="text",
        pipeline=train_pipeline),
    sampler=dict(type="DefaultSampler", shuffle=True),
    batch_sampler=dict(type='AspectRatioBatchSampler')
)

@alelordelo
Copy link
Author

thanks @okotaku ! I didn't find any docs on how to train COntrolNET with custom dataset... The one I found is from HF with the Circle dataset. If you can provide any info on how to train I highly appreciate!

@okotaku
Copy link
Owner

okotaku commented Nov 28, 2023

@alelordelo
I have added documentation on how to prepare the dataset for ControlNet.

#100

Comments are welcomed ;)

@okotaku
Copy link
Owner

okotaku commented Nov 28, 2023

I have also added on how to use Aspect Ratio Bucketing.

#101

@okotaku okotaku closed this as completed Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants