Skip to content

Model Training ‐ Basics

Nikita K edited this page Oct 10, 2023 · 10 revisions

For the 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! If you have slow GPU, you can also try services like Google Colab and RunPod. I'm not an expert in both of them so it'd be better to Google how to use them.

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. Saved model format 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 so we won't need them.

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. Instance Prompt and Class Prompt form a kind of Trigger Prompt, which is advisable to add to the prompt when generating images using trained LoRA.

Training Images is the path to the folder containing images for training the model. Repeats is the number of times each of these images is studied during one epoch of training. Therefore, an epoch consists of studying each image Repeats times. However, if you specify the path to a folder with regularization images, the meaning of which we will discuss later, they will also be studied during the epochs.

Prepare Training Data button will copy dataset 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