bghira / SimpleTuner

A general fine-tuning kit geared toward diffusion models.
GNU Affero General Public License v3.0
1.75k stars 158 forks source link

Backend Crop/Downsampling Debug Feature Request #1020

Closed rafstahelin closed 4 weeks ago

rafstahelin commented 4 weeks ago

Backend Crop/Downsampling Debug Feature Request

Overview

We propose adding a debug feature to SimpleTuner that allows users to visualize the backend image preprocessing, specifically how heads and faces are cropped in different aspect ratios within the dataset. Proposed Implementation Add a new configuration option in the config.json file to enable this debug feature. When enabled, it should generate the preprocessed images in an "images" folder, providing a visual representation of the backend image treatment. Current Workaround Currently, users can achieve this functionality with the following command:

/bin/rm -rf images/*; env SIMPLETUNER_DEBUG_IMAGE_PREP=true SIMPLETUNER_DISABLE_ACCELERATOR=true ENV=l0l0 bash train.sh

image

However, this method causes training to crash, forcing users to run it separately before training to check the results. Benefits

Easy toggle: Users can turn this feature on/off as needed. Real-time debugging: Enables checking image preprocessing during training when doubts arise. Improved user experience: Eliminates the need for separate preprocessing runs.

Technical Details

Implement as a branch config.json key option. Generate preprocessed images in an "images" folder. Ensure compatibility with the training process to avoid crashes.

This feature could significantly enhance the user experience and debugging capabilities of SimpleTuner. Your feedback and suggestions are welcome.

bghira commented 4 weeks ago

it's crashing because you disable the accelerator, simply don't do that but the idea is that you would probably want to check the results separately. writing the entire dataset out into the dir is probably not how most people run it. it would increase storage consumption about 6x.

bghira commented 4 weeks ago

also, it's a feature meant for development, not end-users. putting it into the config file means that users will probably accidentally leave it enabled. having it as a commandline switch is the preferred way to enable debug options

rafstahelin commented 4 weeks ago

Makes sense. Thanks for the explanation. I will just use the thing with accelerator on