Skip to content

Model Training ‐ Basics

Nikita K edited this page Sep 17, 2023 · 10 revisions

For training we will use Kohya's GUI, which is a GUI for Kohya SS scripts. Installation is pretty straightforward, I'm sure you can handle it by yourself!

Now let's go through the most basic settings.

Source model

Here you can open and save a JSON configuration file for your model. In the Model Quick Pick select you need to choose the checkpoint you want to train your model on: either one of the provided, which will be automatically downloaded, or custom to which you can specify the path. The format in which you save the result does not matter much, but if you are downloading models or checkpoints from unverified sources, it's better to download them in .safetensors format, as .ckpt files can potentially contain malicious code. The checkboxes are used for training models based on SD2.0, SD2.1, and SDXL.

Folders

Output folder is the path to the folder where the model files will be saved. Logging folder is the path to the folder where training logs will be saved. These logs are genuinely useful. You can view them by clicking Start tensorboard button. It will open a window with graphs of various parameters of your model. Model output name is the name of the model file that you will use to generate images.

Image folder is the path to the folder containing subfolders with training images. Regularisation folder is the path to the folder containing subfolders with regularisation images. Don't worry about meaning of the regularisation images for now. These last two folders are not as simple as they may seem. We'll use built-in tool for preparing them. Later you can do it manually.

Class prompt is a type of the training entity (man, woman, cat). Meanwhile Instance prompt is a unique token for the model. Token must be a combination of characters that doesn't make sense in the English language. Otherwise, instead of training the neural network on something new, you'll likely be attempting to overwrite its understanding of the specified word, which will probably lead to unexpected results. I use different combinations of 3-4 letters for each model, but you can also use numbers. Many people use the same combination ohwx for every model.

Training images is the path to the folder containing images for training the model. Similarly for Regularisation images. Repeats is the number of times one image will be repeated during one training epoch. During one training epoch, all the images are repeated Repeats times. The mathematics here is straightforward.

Epoch Steps = Image Count * Repeats / Batch Size

Having regularisation images will multiply epoch steps by 2. Batch Size is the number of images processed in parallel during one epoch.

Prepare training data button will copy training images and regularisation images to the Destination training directory. It will also create log folder in there. Copy info to Folders Tab button will copy the paths to these folders to the Folders tab where we initially started. If you now open the img folder at the specified path, you will see a subfolder inside it with a name like <repeats>_<instance prompt> <class prompt>. In the reg folder you will see a subfolder with a name like <repeats>_<class prompt>.


Next - Model Training ‐ Comparison - Introduction

Clone this wiki locally