ShivamShrirao / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch
https://huggingface.co/docs/diffusers
Apache License 2.0
1.89k stars 505 forks source link

Update train_dreambooth.py: added option to shuffle class images #199

Closed martianunlimited closed 1 year ago

martianunlimited commented 1 year ago

Added option to shuffle class images, which I found to be useful when training multiple concepts that belongs in the same class, in improving the fine-tuned model. Current implementation "reuses" the first num_class_images in the directory resulting in the same regularization images used multiple times and the training "overfitting" to the regularization examples. Updated code shuffles the list so that the odds of the same image used for regularization is lower. Note that this option only makes sense if the number of images in the class_data_dir is (much) larger than num_class_images, and this option DOES NOT change the functionality of block ln470-ln513 to generate extra class images.

ShivamShrirao commented 1 year ago

Hey, I actually have a bigger change planned which makes a new sampler for the dataset. That will also be doing this. Just haven't got time to complete it yet.

martianunlimited commented 1 year ago

Cool looking forward to the new sampler.