--- license: mit --- # This is **NOT A GUIDE** for LoRA training, and please NEVER treat it as. # This serves as a onging project that I share some of the personal opinions or interesting findings where I learned or discovered during my journey in LoRA training. To start with, LoRA training could be easy and quick with simple dataset preparation and training setup; but surely that's not what I'm satisfied with. Based on my personal experience, preparing a LoRA's dataset properly is more important than using complicated and fancy training techniques. Just like cooking, you can't make any tasty dishes using materials without good quality. - ### Dataset preparation I'll disscuss several steps that I usually do when I prepare the dataset for a LoRA in order, and I'll skip the "How to Get Image Data" part since there're too many tools/methods available for you to use. 1. After getting all image data needed for a LoRA, remove all none-static image files (.mp4, .wav, .gif, etc). Then change all none-.png format images into .png. 2. Spend some time going through the images to see if there're any duplicated images and remove them. This will happen a lot if the dataset is large. 3. Upscale all low-resolution images to at least 2k resolution. But why? Let's see an example: We have two identical png images, one with 907x823 pixels, the other with 3624x3288 pixels using simple 4x-upscale from SD WebUI. Now let's crop them into roughly 1k resolution (960x832 in this case) using SD WebUI's Auto-size Crop: See the differences? The image with 4x-upscale has a sharper edges comparing to the one without any upscale, and hence looks more clean and less blurry when getting cropped into 1k resolution.
So what does it translate to LoRA learning?
Inside the LoRA training script, we can see a function called [bucket](https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters#enable-buckets).
It'll automatically crop your image data into a size that's closed to the training resolution that we specify in training setup.