How I LoRA: A beginners guide to LoRA training | Part 3: Testing your LoRA


Updated:

A step-by-step guide on how to train a LoRA; part 3!

Warning: This guide is based on Kohya_SS

This guide REQUIRES that you read "How I LoRA: A beginners guide to LoRA training | Part 1: Dataset Prep." and "How I LoRA: A beginners guide to LoRA training | Part 2: Training Basics"

This guide CAN be ported to Tensor.art's trainer; if you know what you are doing.

This guide is an (almost) 1:1 of the following guide: https://civitai.com/articles/3522/valstrixs-crash-course-guide-to-lora-and-lycoris-training

Edits were made to keep it short and only dive into the crucial details. It also removes a lot of recommendations I DO NOT follow.; for more advanced information, please support the original guide. If you want to do things MY way, keep reading.

THE SETTINGS USED ARE BASED ON SDXL, DO NOT FOLLOW IF YOU ARE TRAINING ON V-PRED OR 1.5

Testing your LoRA

There are two ways to test a LoRA. During training and after training.

  • During:

While on your Kohya_ss, there is a section for a "test" prompt. Use it. If you followed the guide you should have set "save every N epoch" as 1. Meaning that every epoch it will save a model and by proxy, test it with the given prompt.

Look at each image, and judge its quality.

  • After (The right way):

After training is done, move all your safetensors files to your lora folder on your WebUI instalation. I will asume you have A1111, A1111 Forge or A1111 Re-Forge (the best one).

  1. On your WebUI, set yourself up with all the settings you would normally use; checkpoint, scheduler, etc.

  2. Copy/paste one of your dataset prompts to the prompt area (This will test overfitting).

  3. Navigate to the LoRA subtab and add the first file; ie.: Shondo_Noob-000001.safetensor, this will add the LoRA to the prompt as: <lora:Shondo_Noob-000001:1>; change the :1 to :0.1

  4. Set a fixed seed; ie.: 1234567890

  5. Scroll down to the "script" area of your WebUI and select X/Y/Z

  6. Set your X, Y and Z as "Prompt S/R"

  7. On X; write all of your LoRA's filenames; ie.: Shondo_Noob-000001, Shondo_Noob-000002, Shondo_Noob-000003, Shondo_Noob-000004, etc. Depending on how many files you saved, their names, etc. ALWAYS SEPARATE WITH A COMMA.

  8. On Y; write all the strength variables from 0.1 to 1, ie.: 0.1, 0.2, 0.3, etc. ALWAYS SEPARATE WITH A COMMA.

  9. On Z; write an alternate tag to test flexibility, so, if your prompt is: "fallenshadow, standing, dress, smile", write something like: dress, nude, swimwear, underwear, etc. This will create a grid where instead of wearing a dress, she will be nude, wear a swimsuit, etc. ALWAYS SEPARATE WITH A COMMA.

If you did a concept LoRA or a style lora:

  1. On your WebUI, set yourself up with all the settings you would normally use; checkpoint, scheduler, etc.

  2. Copy/paste one of your dataset prompts to the prompt area (This will test overfitting).

  3. Navigate to the LoRA subtab and add the first file; ie.: doggystyle-000001.safetensor, this will add the LoRA to the prompt as: <lora:doggystyle-000001:1>; change the :1 to :0.1

  4. Set a fixed seed; ie.: 1234567890

  5. Scroll down to the "script" area of your WebUI and select X/Y/Z

  6. Set your X and Y as "Prompt S/R"

  7. On X; write all of your LoRA's filenames; ie.: doggystyle-000001, doggystyle-000002, Shondo_Noob-000003, doggystyle-000004, etc. Depending on how many files you saved, their names, etc. ALWAYS SEPARATE WITH A COMMA.

  8. On Y; write all the strength variables from 0.1 to 1, ie.: 0.1, 0.2, 0.3, etc. ALWAYS SEPARATE WITH A COMMA.

Selecting the right file

Once the process finishes, you should have at least 2 grids, one XY with dress, and another with nude (for example). Or one if you didnt set up an Z grid. Up to you.

Now look at the grid and look for the "best" result. Look at the art style bias, pose bias, look bias, etc. The more flexible the better. If on fallenshadow-000005 shondo's pose is always unique but after 000006 she's always standing the same way, ignore 000006+

If at some point the art style gets ignored or changes and fixates on it; ignore it.

If at some point ANYTHING starts repeating that you don't want; ignore it.

The only thing that should repeat at all times is whatever corresponds to the trained concept. If you only trained a wolf with a hat but it should always be a different hat, avoid a file that gives him the same hat on the same pose with the same style.

If the result image is identical to the training data; avoid it! You are not here to do the same images as your data, you are here to make new ones, remember?

If colors are weird; bad.

If shapes are mushy; bad.

If angle is always the same; bad (unless you prompted for it).

Anything that goes against the concept or the flexibility of it: BAD.

Any file that has to be lower than 1 or 0.9: BAD. If your LoRA "works best" at 0.6 strenght, it's shit.

THIS IS IT FOR PART 3. Now do some good cool loras.

121
0