Sign In

Tutorial: konyconi-style LoRA - konyconi

1.3k
4.8k
51
Updated: Jan 9, 2024
guide
Type
Other
Stats
2,673
Reviews
Uploaded
Apr 30, 2023
Base Model
SD 1.5
Hash
AutoV2
45724CBAE1

New version of this tutorial is here: https://civitai.com/articles/771/tutorial-konyconi-style-lora-update

After some trial and error, I discovered an efficient method for creating LoRAs that can apply styles or features to various items. My LoRAs have been well-received here, on civitai.com, and it's surprising how easy and fast the process is. It almost feels like cheating. I've enjoyed the recognition, but I believe it's time to humbly share my approach with everyone at no cost.

This tutorial showcases the typical process I follow for creating most of my LoRAs.

TLDR version: I utilize generated images; I incorporate simplistic illustrations into the training data; I employ basic captioning: [triggerword] [concept], and I use a simple Python script to create the caption files.



STEP 1: Find an idea (style / feature) and check that SD with your favorite checkpoint can't do it. Let's say, the boho-style.

Dear revAnimated, please generate a "boho tank" for me:


OK, the boho-style seems a good idea to try,


STEP 2: Check other image generators.

Dear Bing, please generate a "boho tank" for me:
prompt: illustration of battle tank in boho-style


Dear DALEE-2, please generate a "boho tank" for me:
prompt: battle tank in boho style, illustration


OK, we can see that these pictures somewhat capture the boho-style. Therefore ....


STEP 3: Generate the training set using an image generator which can understand the boho-style.

Some of my LoRAs use no generated images in the training set, while others incorporate a portion of generated images. Notably, my most recent LoRAs rely exclusively on generated pictures.


For example, generate "boho tank," "boho computer," "boho village," "boho dirigible," "boho submarine," etc. Aim for 1-6 images per concept, totaling 50-100 images.


When you generate such uncommon things, like "boho tank" you might come across images such the ones shown in STEP 2. Don't worry about including these images in the training data; they're often better than (semi-)realistic pictures. For instance, my training data for BohoAI only contains the following examples of dirigibles:



Yet, the final model produces this:


Include also some (semi-)realistic pictures. They should not be problem to generate for some concepts, like "boho living room".

STEP 4: Clean up the images by removing logos, generated author signatures, and other similar elements. Also remove unwanted artefacts, like the extra cannon on the tank tower.
The removal can be quite crude: just place other part of the picture over the unwanted part.

Do not resize the picture.

STEP 5: Captioning.

Use very basic captions, like "BohoAI dirigible."

To expedite the process, try this trick: save the images in a folder named after the concept. So, all dirigible pictures will be in a folder named "dirigible."

Once you have all images organized in their respective folders, execute the Python procedure I provide in attached files. It recursively travels through folders, and for each .jpg file creates .txt containing a given triggerword and the folder name.

STEP 6: We are good to go. Train the LoRA.

I think that you cannot go wrong with your usual setting.
After some experimenting, it seems that rank 128 and alpha 128 are needed to get the desired result. I'm going to make a deeper study later.

I'm sharing the config for kohya ss, but please take it with a grain of salt. I often change it and experiment blindly. BohoAI was trained with this config using 10 repetitions.

The LoRA encapsulates boho-style, adeptly applying it to untrained concepts.


Check dajusha's review picture (there are no pictures of any animals in my dataset.): https://civitai.com/images/616301?period=Week&periodMode=published&sort=Most+Reactions&view=categories&modelVersionId=56427&modelId=51966&postId=172873

I've shared my secret and kindly request one favor: if you publish your LoRA trained using this method, please credit this tutorial.


Numerous creators can adopt and enhance this idea, ultimately elevating the quality of civitai.com content. By sharing my golden goose, I kindly ask you to consider supporting me with a coffee through these links:

https://www.buymeacoffee.com/konyconiN

https://ko-fi.com/konyconi7992