An essay on the embedding training of stable diffusion

foreword

Well, because ai painting is very popular recently, and it can be deployed locally, many people start to feed ai and draw something they like. This is a note that I have just been in contact with for 4 days. Then I will organize the catalog and show this note. What is it.

1, Keywords and reverse keywords of painting

2. Adjust parameters, HD and face repair

3. Training material preparation and principle suggestions for the embedding model

4. Precautions for alchemy

So let's talk about the first

Keyword: This operation principle is based on a large model (model after downloading), that is, the file in this path after you install it, ending with .ckpt

models\Stable-diffusion

You can download these through C station (needs magic), C station itself is not particularly stable, and there are some small bugs, I recommend kittens here, but since you have seen the length of the training, then you have already Some understand it, and generally a model will come with it after installation, so don't worry. Because unless there is a special instruction that comes with it, there will be no special preference for a certain type of picture painting. For example, if I download a cat pet cat model, even if I input words that have nothing to do with cats, pictures about cats will still be generated.
Alright, now let's talk about keywords. Literally, this is what you want AI to draw and what you don’t want to draw. In the early stage without a good model, of course, the more detailed the better, you can use Baidu translation or chatGPT dialogue to get what you need Keywords are converted into English and can be separated by "," or spaces. Of course, you can also use some pre-trained models. From here, we can select the downloaded models we need on the main page.
insert image description here
Let’s talk about the reverse keyword in particular. When choosing this word, it is usually very abstract. For example, if I want to draw a picture of a landscape, then I may fill in the forward keyword: masterpiece, spring, lakeside, mountainside, blue sky (all of the above English is required). Then I will fill in the reverse keywords: low quality, ambiguous, this kind of vocabulary, because when we haven’t practiced the specific style, we don’t know what problems will happen. Write the problem in this column, just can reduce the probability of occurrence.
(However, this cannot be completely avoided. For example, when I tried to draw furry-style pictures in the early days, there would always be more than 3 tails. Even if I specified forward: one tail; reverse: more than one tail, it may still make AI understand Wrong, this kind of stuff takes our time.

The second parameter adjustment, facial and high-definition restoration

insert image description here
You can see a lot of things, but the parameters we can adjust at the beginning are generally:
sampling method, number of iteration steps, face restoration, high-definition restoration, height and width, prompt word correlation, generation batch and quantity.
You can choose the sampling method according to your preference. Using iteration will increase the speed of your graphics card (not), so that the quality of your output image will be improved. Face repair refers to that sometimes your painting may have various problems of dropping sans, such as No nose, crooked mouth, slanted eyes, or even two mouths and two noses. The default redrawing range is 0.7. Generally, we don’t need to adjust this attribute. If conditions permit, you can enable it, which will greatly shorten your preparation for alchemy time.
HD Restoration, as the name suggests, is clearer. You can choose different magnification algorithms to make the picture quality higher. However, it is not recommended for those who are too hand-painted. The default is to double the magnification, and it will not redraw the painting content itself.
The batch and quantity are how many times you want to draw, and how many sheets each time, for example, you can hang 80-100 sheets when you go out for a walk, and you can check the results of drawing cards after you come back. Correlation is not as high as possible. Many times you don’t know what you want. Sometimes a misunderstanding of AI can improve the picture you want by more than one level. It’s a bit like writing a bug, but this bug is not obvious. If it is harmful or even profitable, then we can just use it. We need to make our own decisions, increase it a little bit or keep the status quo.

Material preparation and training matters

First of all, you are ready to train a painting style, then you need to have at least 50 pictures, here the painting style is required to be the same, mixing is strictly prohibited, and the clarity should be the same as much as possible, you can use the pictures drawn by your own ai to make alchemy, which can be greatly improved To alleviate this problem, we can do the initial preparations on this page.
insert image description here
Create a name, the initialization text can not be filled in, the word element vector depends on your needs, generally from 7-16, probably from ai painting style practice to ai painter practice, painter practice refers to a more specific category, such as animals. The painting style is not so harsh, such as medieval style, cyber style, and the like.

image preprocessing

insert image description here
Generally speaking, you can fill in this page. The original directory is the gallery you plan to train. You need to create a blank folder on the desktop or somewhere in the target directory, and fill in the file location. Then we click Preset. Just deal with it.

Alchemy matters:

1. Alchemy requires high computer configuration. Generally speaking, A card is not recommended, and it cannot be practiced if the video memory is less than 8G. Of course, there are ways, but it’s just a hassle.
2. You don't need a 100% trained AI. Repeatedly running the painting style may not necessarily get you satisfactory results.

Finally, alchemy begins

insert image description here
The maximum number of steps depends on your own needs. The painting style is about 15000-18000, and the drawing hand is about 3-4w. The data set directory is the folder directory that you have created above. Check the box below and follow the picture. All other parameters do not need to be changed, and then click on the lower left corner to train. . Then you can hang up and do other things~ For example, make up time and play with your mobile phone. In short, training will consume a lot of resources and a long time. This time basically bid farewell to computer games. The most expensive time is me. The running environment is 15g video memory, which takes up 14.7g stably.
Finally, Xiaobai who has just studied can chat with each other, comment or private message.

Guess you like

Origin blog.csdn.net/qq_55332182/article/details/129954483