BMaltai's Kohya_SS local LoRA setup guide (windows oriented) by closertodeath#1703 (real)
This is focused on beginners. The training settings probably aren't 100% optimal but should do well.
Github repositories used in this guide:
1: Kohya Script: https://github.com/kohya-ss/sd-scripts
2: GUI to use Kohya Script : https://github.com/bmaltais/kohya_ss
3: Scrapper: https://github.com/sALTaccount/SeaSalt-Downloader or https://github.com/Bionus/imgbrd-grabber.
4: Tagger: https://github.com/toriato/stable-diffusion-webui-wd14-tagger
PREPARING YOUR DATASET
Step 1:
Acquire as many images as you can of the style/character you want. Consider using a scraper like https://github.com/sALTaccount/SeaSalt-Downloader or https://github.com/Bionus/imgbrd-grabber.
Step 2:
Filter out low quality images.For characters: Images that get their hair/eye color wrong, hair design, etc. Multiple characters.
For styles: Images that stray too much from the style you're wishing to achieve and low quality artwork (as in artifacts, cropped, jpeg artifacts, that sort of thing)
Step 3:
Put them all in a folder with no spaces in the name of the folder and no extra folders inside. Make sure your image folder only has the images and the text files.
TAGGING
Determine if you want special tokens for alternate outfits or not. Does your character have a well known alternate outfit? You might want to add a special token for it like "mksksjacket" or "sksraincoat". I'm usually too lazy to do this and it turns out fine, but if it isn't being learned correctly, consider adding a special token. You can do this after you've tagged all the images, go through the tags and add the token to the pictures .txt file with the outfit you want.
Step 1:
Download this extension and enable it in your webui https://github.com/toriato/stable-diffusion-webui-wd14-tagger You may need to restart the webui & refresh the page completely for it to show up.
Step 2:
Go to the "Tagger" tab and select the interrogator wd14-swinv2-v2-git. It's around 553mb iirc so it will take a bit to download.
Step 3:
Make sure "use spaces instead of underscores" is checked and "Escape Brackets" is unchecked.
Step 4:
Instead of single process, go to "Batch Directory" and enter the location of where your image folder is.
Step 5:
Press interrogate and wait until all your images have been tagged.
Step 6:
Close WebUI.
SETTING UP KOHYA_SS
Step 1:
Open up a command prompt (press windows key + r and type cmd)
Step 2:
type git clone https://github.com/bmaltais/kohya_ss.git, then cd kohya_ss, then setup.bat. You can leave all the accelerate configs default as far as I know. (just press enter when it asks you something). Type gui.bat after the setup is done. Go to the address it gives you (http://127.0.0.1:7860/)
Step 3:
Go to the "Dreambooth LoRA" tab.
Step 4:
Go to tools. Put the instance + class prompt to something like mksks 1boy or mksks style. In training images input your image folder, and set the repeats to 25. Leave the reg images folder empty. Set the destination directory to wherever you'd like. Press prepare training data. Wait a few seconds, and then press copy info to folders tab.
Step 5:
Go to configuration file and download the one I have linked here, then open it.
Step 6:
Go to Source Model and set the model as "custom" and then press the white paper and go to the model you want to train on. If it's a v2 model like WD1.5, make sure to enable V2 and V-Param. If not, leave those options unchecked.
Step 7:
Go to the folders tab and set the model output name to what you want.
Step 8:
Go to Training Parameters, scroll down and open the sample images config. Change the base prompt to whatever you'd like it to be. You can grab one of the tagsets from your image folder if you'd like.
Step 9:
Press "Train Model". The model will be located in the destination directory you set in step 4. The samples that occur every 100 steps will be in the models/samples folder in that directory.
USING YOUR MODEL
Step 1:
Go to the destination training folder and go to the models folder. Grab all the .safetensors files there and copy them.
Step 2:
Go to stable-diffusion-webui\models\Lora and put your loras there. Use them as you would any other lora. Test the different epochs to see which one you like best.
Step 3:
If you don't know how to do step 2, press the red square in WEBUI.
.json to be used as a base that you load into kohya_ss
(They are the ones I recommend for the guide: basic beginner settings). I have the training settings set up very basically so you most likely need to adjust the batch size, but this is fine for a first run I think.